next up previous contents index
Next: Subtracting a number: `sub' Up: Extended Numerical Abstractions Previous: Abstraction `zeropair'   Contents   Index

Decrementing a number: `pred'

This abstraction determines the predecessor of a natural number, which corresponds to decrementing it.
(define pred (lambda (n)
(cdr ((n (lambda (x)
(cons (add (car x) one)
(car x))))

(ndisp! (pred one))
--> 0
(ndisp! (pred three))
--> 2

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