> (lambda (x y) (+ x y)) #<procedure>
> (define s (lambda (x y) (+ x y)))
> (s 2 5) 7
(define (sum x y) (+ x y)) (define sum (lambda (x y) (+ x y)))
(define (mcons a b) (lambda (cmd) (if (equal? cmd "car") a b))) (define (mcar pair) (pair "car")) (define (mcdr pair) (pair "cdr"))
> (define foo (mcons 1 2))
> (mcar foo) 1
> (mcdr foo) 2
(define n0 (lambda () null)) (define (minc x) (lambda () x)) (define (mdec x) (x))
(define n1 (minc n0)) (define n2 (minc n1)) (define n3 (minc n2)) (define n4 (minc n3)) (define n5 (minc n4))
(define n0 (lambda () null))
(define (minc x) (lambda () x))
(define n1 (minc n0))
(define n2 (minc n1))
> (n0) ()
> (n1) #<procedure:n0>
> (n2) #<procedure>
(define (mzero? x) (null? (x))) (define (mequal? x y) (cond ((mzero? x) (mzero? y)) ((mzero? y) (mzero? x)) (else (mequal? (mdec x) (mdec y)))))
> (mequal? n1 n0) #f
> (mequal? n1 n1) #t
> (mequal? n4 n5) #f
> (mequal? n4 n4) #t
(define (m+ x y) (if (mzero? y) x (m+ (minc x) (mdec y))))
> (mequal? (m+ n0 n2) n2) #t
> (mequal? (m+ n0 n2) n3) #f
> (mequal? (m+ n0 n2) (m+ n1 n2)) #f
> (mequal? (m+ n2 n3) n5) #t
> (mequal? (m+ n5 n5) (m+ n4 (m+ n3 n3))) #t