[plt-scheme] What is the big deal about the currying of functions?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu May 24 18:08:36 EDT 2007

On May 24, 2007, at 6:02 PM, Grant Rettke wrote:

> I hear folks talk about how great is a language when it lets you curry
> functions, and that Scheme can do it too if you use macros.
>
> In your minds what is, and what is the value of, function currying?

Auto-Currying (which is what you mean) is absolutely necessary in a  
lazy functional language and useful because

  (lambda (x) (lambda (y)

is really indistinguishable from

  (lambda (x y) ...

In a by-value language with imperative effects, this is simply not  
true (even in the pure form you have two allocation effects,  
noticable with eq?).  That's why the language makes the programmer  
decide when to curry and when not to curry.

Then again, when you program in a functional style and subset of  
something like Scheme, it would be nice to say things like

  (map (+ 4) ...) meaning (map (lambda (x) (+ 4 x)) ...
  (filter (< 4) ...) meaning (filter (lambda (x) (< 4 x)) ...

but both (+ 4) and (< 4) have already meaning and it is NOT the  
above. So we suffer .. but it's not too bad. Otherwise you wouldn't  
find Scheme programmers. -- Matthias




Posted on the users mailing list.