[Haskell-cafe] supplying some of the arguments to a function

Daniel Carrera dcarrera at digitaldistribution.com
Fri May 6 12:21:20 EDT 2005


Hi Mark,

 > if I had a function f that took x y and z in that order, is there some
 > way that I can supply y and z and get back a function that takes x?

Warning: I just began using Haskell last week. :-)

The closest I can think of is this:

  (\x -> f x 2 3)

(assuming you want y=2, z=3)

But that's really defining a new function, so you might as well give it 
a name:

g x = f x 2 3

> This question comes about after talking with a prof about currying and
> wether it buys you anything.

I'm liking currying a lot, I must admit. :-)  But the example above 
isn't currying AFAIK.

Cheers,
Daniel.


More information about the Haskell-Cafe mailing list