next up previous contents index
Next: Converting all elements in Up: Higher Order Functions Previous: Creating a new function   Contents   Index


Changing the arity of a function:`curry'

This abstraction takes a function as an argument that expects two arguments and returns a function expecting only one argument. That this abstraction can be very useful is shown below introducing the abstraction `mapc'.

The `curry' abstraction is named after the logician H.B. Curry.
\begin{lstlisting}[language=Scm]{}
(define curry (lambda(f)
(lambda(x)
(lambda(y)
(f x y)))))
\end{lstlisting}


domain access counter Georg P. Loczewski 2004-03-05