[Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

Dietrich Epp depp at zdome.net
Sat Mar 27 09:21:23 EDT 2010


I think Miljenovic was asking about this (I removed explicit braces):

     fac n = let f = foldr (*) 1 [1..n] in f

Which is strictly equivalent to:

     fac n = foldr (*) 1 [1..n]

Translated into C, this is kind of like doing this:

     int add(int x, int y)
     {
         int sum = x + y;
         return sum;
     }

instead of this:

     int add(int x, int y)
     {
         return x + y;
     }

I find it very cumbersome (though not *difficult*) and painful to use  
a C style of programming with Haskell, so I am not sure what you mean  
when you ask why Haskell supports C style.  Are you talking about  
mutable state, syntax, or something else?

--Dietrich

On 2010 March 27, at 4:28, zaxis wrote:

>
> Of course, you are wrong !  C is VERY important for almost every  
> programmer
> in the world!  Why cannot C programmer use haskell ?   And Why does  
> haskell
> support C code style ?
>
>
> Ivan Miljenovic wrote:
>>
>> zaxis <z_axis at 163.com> writes:
>>
>>>>> Why do you bother with the interior definition of f in there?
>>> Because i want to try a C code style not layout style without `do`  
>>> syntax
>>> sugar .
>>
>> Haskell /= C, so stop trying to code as if it is.  If you like C so
>> much, then use C.
>>
>> -- 
>> Ivan Lazar Miljenovic
>> Ivan.Miljenovic at gmail.com
>> IvanMiljenovic.wordpress.com
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
>
> -----
> fac n = let {  f = foldr (*) 1 [1..n] } in f
> -- 
> View this message in context: http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28051693.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list