Scheme code modeling examples from this. Substituting ‘lambda’ for ‘λ’ makes the following code legal Scheme. MzScheme on the Mac, at least, takes the code as is.

pr is meta code to compensate for the fact that Scheme interpreters do not manifest procedures when printed but only their yield when applied. They are tools to understand the formal Church development. If n is a Scheme integer then (rd n) yields the corresponding Church integer. pr is the opposite map.

```(define I (λ (x) x))

(define C0 (λ (s) (λ (z) z)))
(define C1 (λ (s) (λ (z) (s z))))
(define C2 (λ (s) (λ (z) (s (s z)))))
(define S (λ (w) (λ (y) (λ (x) (y ((w y) x))))))

(define (pr n) ((n (λ (x) (+ x 1))) 0))
(define C3 (S C2))
(pr C0) ; => 0
(pr C1) ; => 1
(pr C2) ; => 2
(pr C3) ; => 3
(pr ((C2 S) C3)) ; => 5
(C3 car) = caaar

(define add (λ (a) (λ (b) ((a S) b))))
Alternatively (define ((add a) b) ((a S) b))
(define mul (λ (x) (λ (y) (λ (z) (x (y z))))))
(pr ((add C2) C3)) ; => 5
(pr ((mul C3) C3)) ; => 9
(define (rd n) (if (zero? n) C0 (S (rd (- n 1)))))
(pr (rd 12)) ; => 12
(define C4 (S C3))
(pr (C3 C4)) ; => 64 = 43
(pr (C4 C3)) ; => 81 = 34

(define T (λ (x) (λ (y) x)))
(define F (λ (x) (λ (y) y)))
(define & (λ(x) (λ(y) ((x y) (λ(u) (λ(v) v))))))
(define (tel b) ((b 'yes) 'no))
(tel ((& T) T)) ; => yes
```