next up previous contents index
Next: succ Up: Arithmetic Operations Previous: compose   Contents   Index


Adding two numbers: add


\begin{lstlisting}[language=Scm,stepnumber=2]{}
(define add (lambda (m n)
(lambda (f)
(compose (m f) (n f)))))
\end{lstlisting}
This abstraction returns the arithmetic sum of two Church Numerals. The simple abstraction `compose' allows us to elegantly define the abstraction for addition. But that things are not quite as simple as they look is demonstrated in our first appendix. Please refer to a detailed analysis of addition and multiplication using the example: (add two three) and (mult two three). This appendix is found on page [*].


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