Y-combinator
;; Scheme 版的 Y-combinator
(define (Y f)
((lambda (g) (lambda (h) ((f (g g)) h)))
(lambda (g) (lambda (h) ((f (g g)) h)))))
;; 6 的阶乘
((Y (lambda (fn) (lambda (x)
(if (zero? x) 1 (* x (fn (1- x ))))))) 6)
标签: scheme
Let only that little be left of me whereby I may name thee my all.
;; Scheme 版的 Y-combinator
标签: scheme
0 Comments:
发表评论
<< Home