;2.6
;zero
(define zero (lambda (f) (lambda (x) x)))
;add 1 operation
(define (add-1 n)
(lambda (f) (lambda (x) (f ((n f) x)))))
;one
(define one (lambda (f) (lambda (x) (f x))))
;two
(define two (lambda (f) (lambda (x) (f (f x)))))
;add
(define (add a b)
(lambda (f) (lambda (x) ((b f) ((a f) x)))))
;three
(define three (add one two))
;mul
(define (mul a b)
(lambda (f) (lambda (x) ( (a (b f)) x))))
2.6
最新推荐文章于 2024-08-22 08:00:00 发布