
3 Dec
2012
3 Dec
'12
9:04 p.m.
Brent Yorgey
On Mon, Dec 03, 2012 at 12:28:08PM +0000, Miguel Negrao wrote:
Is there a syntax in Haskell for partial application that would be something like this the following ?
f a b c d = a +b+ c+ d
g = f _ 1 2 3
or the only way to do it is like below ?
g = (\x -> f x 1 2 3)
Yes, a lambda is the only way to do it.
In the case where you have fewer (specifically two) variables, you can also use `flip`:: f a b = a / b -- g = f _ 2 can be written as: g = flip f 2 -Keshav