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

Christian Maeder maeder at tzi.de
Thu Aug 17 04:46:29 EDT 2006


 map (\x -> x - 2) [1..5]
or
 map (flip (-) 2) [1..5]

HTH Christian

Tamas K Papp schrieb:
> 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?
> 
> Thanks,
> 
> Tamas


More information about the Haskell-Cafe mailing list