
3 Jul
2007
3 Jul
'07
6:01 a.m.
On 03/07/07, peterv
In Haskell, currying can only be done on the last (rightmost) function arguments.
So
foo x y
can be curried as
foo x
but not as
foo ? y
where ? would be a "wilcard" for the x parameter.
The function flip can be used in two-argument functions, if you only have second argument but not the first:
function ??? arg2 -- this is what you mean flip function arg2 -- this is how you write it
So for example
let nums = flip map [1..10] nums (*2) [2,4,6,8,10,12,14,16,18,20] nums (subtract 1) [0,1,2,3,4,5,6,7,8,9]
For the general situation of N arguments, I don't think there are any predefined functions to help you. (After all, as N increases, the number of variations of argument order gets rather silly.) cheers D.