next up previous contents index
Next: Changing the arity of Up: Higher Order Functions Previous: Higher Order Functions   Contents   Index


Creating a new function by composition: `compose'

This abstraction takes two input functions as input arguments and returns a new function composed ot the two inputs.

This lambda-abstraction is very useful for example in defining the abstractions for addition and multiplication. See also section basic:add and basic:mult.
\begin{lstlisting}[language=Scm]{}
(define compose (lambda (f g)
(lambda (x)
(f (g x)))))
\end{lstlisting}


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