Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Specializing Functions with Currying

by tilly (Archbishop)
on Aug 06, 2004 at 18:44 UTC ( #380661=note: print w/replies, xml ) Need Help??

in reply to Re: Specializing Functions with Currying
in thread Specializing Functions with Currying

Using the wrong word will not help you communicate.

Talking about currying is not exactly the same as talking about closures. Currying is a specific programming technique that can be implemented with closures. Currying is the idea that if I have some arguments for a function now, and will have more later, that I can right now generate a closure that has pre-bound some arguments and avoid having to pass around the arguments everywhere. Thus a curried function is a specific type of closure. A closure is somewhat more general though - for instance you can have multiple closures that privately communicate through their shared environment.

The distinction may become more apparent in Perl 6 because they are adding support to give a direct syntax for currying. And you'll see that sometimes that syntax is enough, and other times you'll want to do extra work and create a closure by hand. (In Perl 5, of course, when you want to curry it is often simpler just to create a closure by hand.)

  • Comment on Re^2: Specializing Functions with Currying

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://380661]
[1nickt]: marto all good after the hurricane?
erix .o.O ( I reckon yet again some pieces broke off UK are added to NL downstream... )

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2017-10-17 10:28 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (225 votes). Check out past polls.