Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-01-22 03:05 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (231 votes). Check out past polls.