[Haskell-beginners] Better way to write this?
Rahul Kapoor
rk at trie.org
Tue Mar 9 15:33:11 EST 2010
>However, the solution given uses notation that confuses my
>little mind. Can someone point me to a good resource on this
>notation?
> myLength :: [a] -> Int myLength = foldr (\x n -> n + 1) 0
"\x n -> n + 1" in the above is an anonymous function.
More at:
http://www.haskell.org/haskellwiki/Anonymous_function
http://www.haskell.org/haskellwiki/Lambda_abstraction
Regards,
Rahul
More information about the Beginners
mailing list