The operation performed by the operator described here is actually called "Partial Application". A good definition of currying can be found in http://tinyurl.com/3d6w6 and http://tinyurl.com/ly29. Several languages have misused the term "curry" this way http://tinyurl.com/2p6gb, http://tinyurl.com/2onya (Python) http://tinyurl.com/36pus (JavaScript) http://tinyurl.com/3dj6j (Dylan) Currying transforms a function taking a single tuple argument into a function taking multiple arguments, and uncurrying reverses the process.
def curry(f): ... return lambda *args: f(args) ... def add2(args): # add the first 2 elements of an argument tuple ... return args[0] + args[1] ... curry(add2)(1,2) # make add2 accept multiple args 3 def uncurry(f): ... return lambda x: f(*x) ... uncurry(curry(add2))((1,2)) # reverse currying; pass a tuple 3
-- Dave Abrahams Boost Consulting www.boost-consulting.com