currying


Currying is a method of transforming a function of multiple arguments into the application of a succession of functions, each of one argument.

 (define (add a b) 
   (+ a b)) 
  
 (define (curried-add a) 
   (lambda (b) 
     (+ a b))) 

In PLT Scheme, there is syntactic sugar for expressing the above more compactly:

 (define ((curried-add2 a) b) 
   (+ a b))