(f x y)
equals ((g x) y)
. By extension, fully currying a function f of three arguments produces g such that f(x, y, z) equals ((g(x))(y))(z), or in Lisp notation (f x y z)
equals (((g x) y) z)
.
To do currying in the Scheme programming language:
(define curry2 (lambda (f) (lambda (x) ; take the first argument (lambda y ; and the rest of the args as a list (f x . y)))))
If g equals (curry2 f)
, then (f x y)
equals ((g x) y)
, and (f x y z)
equals ((g x) y z)
.
These languages automatically fully curry functions called with too few arguments:
See also:
Search Encyclopedia

Featured Article
