[Python-ideas] Syntax for curried functions

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 3 21:56:56 CET 2009


Weeble wrote:

> I don't think it's generally useful enough to merit
> a change to the language, but somehow the idea floated into my head
> and it just seemed so *neat* that I had to tell somebody.

The designers of at least one other language seem to
think it's neat, too. Scheme has an exactly analogous
construct:

   (define ((f x) y)
     ...)

which is shorthand for

   (define f
     (lambda (x)
       (lambda (y) ...)))

[The *really* neat thing about the Scheme version is
the way it just naturally falls out of the macro expansion
of 'define' in terms of 'lambda' -- so it's not really
a separate language feature at all!]

-- 
Greg



More information about the Python-ideas mailing list