News for hackers. Stuff that matters.
Re:Ask HN: which functional language to learn? by samstokes on Tuesday July 07, 2009 @07:23PM (#692839)
I also find I use lambdas less in Haskell than in other languages. I think it's because in Haskell, constructs like partial application, function composition or lifting are concise and natural to express, and those constructs cover most common use cases for an anonymous function. I think

map (find needle) haystacks

is clearer (as well as shorter!) than

map (\haystack -> find needle haystack) haystacks

In most other languages things like partial application are a pain to express, so a lambda is an easier way out.

(Now I'm imagining the six lines of Java I'd have to write to achieve the same effect as those four words of Haskell, and trying not to giggle. Functional style is addictive.)

There are no comments on this comment yet.