[Haskell-cafe] map (-2) [1..5]

Stefan Holdermans stefan at cs.uu.nl
Thu Aug 17 04:49:45 EDT 2006


Tamas,

> The code in the subject generates an error.  I understand why this is
> (- is treated as part of the number), but I don't know how to solve
> it, ie how to tell Haskell that - is a function/binary operator?

What about

   map (flip (-) 2) [1 .. 5]

or

   map (+ (- 2)) [1 .. 5]

?

HTH,

   Stefan


More information about the Haskell-Cafe mailing list