the applicative-order Y-combinator
(define Y (lambda (f) (let ((future (lambda (future) (f (lambda (arg) ((future future) arg)))))) (future future)))) ((Y (lambda (factorial) (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1))))))) 42)
DZone Snippets > frontera000 > Y-combinator
12388 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
(define Y (lambda (f) (let ((future (lambda (future) (f (lambda (arg) ((future future) arg)))))) (future future)))) ((Y (lambda (factorial) (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1))))))) 42)