next up previous contents index
Next: Adding two numbers: add Up: Arithmetic Operations Previous: Arithmetic Operations   Contents   Index


compose


\begin{lstlisting}[language=Scm,stepnumber=2]{}
(define compose (lambda (f g)
(lambda (x)
(f (g x)))))
\end{lstlisting}
This abstraction is a functional utility abstraction which makes addition and multiplication of Church Numerals a simple task, even if the understanding of this code might not be that easy. `compose' belongs to the category of `higher order functions' because it takes functions as arguments and returns a new function composed of the two arguments. See also section basic:compose.


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