[Haskell-cafe] Currying
Peter Berry
pwberry at gmail.com
Thu Jan 18 09:06:30 EST 2007
On 18/01/07, Chris Eidhof <chris at eidhof.nl> wrote:
> That's exactly what I love about haskell: it saves me from a
> lot of unnecessary typing. After all, I'm a lazy programmer ;)
Lazy languages for lazy programmers 8)
On 18/1/2007, Johan Grönqvist <johan.gronqvist at gmail.com> wrote:
> add x y = x + y
> map (add 2) [1..5]
Don't know if you know this, but infix operators like (+) are
functions too, and you can partially apply them using 'sections':
map (+2) [1..5]
It's only syntax, but this is one of the things I really like about Haskell.
--
Peter Berry <pwberry at gmail.com>
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
More information about the Haskell-Cafe
mailing list