[Haskell-cafe] About code style ?

zaxis z_axis at 163.com
Tue Feb 2 19:15:56 EST 2010


fac n = let {  f = foldr (*) 1 [1..n] } in f
VERY interesting :)


Jinjing Wang wrote:
> 
> fac n = let {
>   f = foldr (*) 1 [1..n]
>   } in f
> 
> :D
> 
> sorry for double reply, need to cc cafe, this is fun.
> 
> On Tue, Feb 2, 2010 at 4:33 PM, zaxis <z_axis at 163.com> wrote:
>>
>> thanks for all suggestions.
>>
>>
>> zaxis wrote:
>>>
>>> For me i like C style instead of layout. For example,
>>> func1 a = do
>>>      -- ...
>>>      a * 2
>>>      -- ...
>>>
>>> I always write it as:
>>> func1 a = do {
>>>   -- ...;
>>>    a * 2;
>>>   -- ...;
>>> }
>>>
>>> However, i donot know how to write pure function using C style.
>>> func1 a = {
>>>   -- ...;
>>>    a * 2;
>>>   -- ...;
>>> }
>>>
>>> will not compile without `do`.
>>>
>>> Sincerely!
>>>
>>
>>
>> -----
>> fac n = foldr (*) 1 [1..n]
>> --
>> View this message in context:
>> http://old.nabble.com/About-code-style---tp27414627p27416932.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
>>
> 
> 
> 
> -- 
> jinjing
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 


-----
fac n = foldr (*) 1 [1..n]
-- 
View this message in context: http://old.nabble.com/About-code-style---tp27414627p27429649.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list