next up previous contents index
Next: Relational Abstractions Up: Extended Numerical Abstractions Previous: Decrementing a number: `pred'   Contents   Index


Subtracting a number: `sub'

The expression $ m - n$ is evaluated by decrementing $ m$ $ n$-times.
\begin{lstlisting}[language=Scm]{}
(define sub (lambda (m n)
((n pred) m)))
\end{lstlisting}


\begin{lstlisting}[language=Scm]{}
(ndisp! (sub three two))
--> 1
(ndisp! (sub four two))
--> 2
\end{lstlisting}



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