Implementation of Church numerals, of calculus and the addition procedure.

 


(define
zero
(lambda (f)
(lambda (x)
x)))
(define
one
(lambda (f)
(lambda (x)
(f x))))
(define
two
(lambda (f)
(lambda (x)
(f (f x)))))
(define (add-1 n)
(lambda (f)
(lambda (x)
(f
((n f)
x)))))
(define (add a b)
(lambda (f)
(lambda (x)
((a f)
((b f)
x)))))

view raw

s206.scm

hosted with ❤ by GitHub

Discover more from Gaurav Sharma's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading