Created
March 19, 2013 00:08
-
-
Save ayato-p/5192276 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define Y | |
(lambda (f) | |
((lambda (x) (x x)) | |
(lambda (x) | |
(f (lambda (y) ((x x) y))))))) | |
((Y (lambda (fact) | |
(lambda (x) | |
(cond | |
((zero? x) 1) | |
(else (* x (fact (- x 1)))))))) | |
5) | |
(define fact | |
(lambda (n) | |
(cond | |
((zero? n) 1) | |
(else | |
(* n (fact (- n 1))))))) | |
(fact 10) | |
((lambda (x) | |
((x (lambda (y) | |
(+ y 1))) | |
0)) | |
((lambda (n) | |
(lambda (f) | |
(lambda (x) | |
(f ((n f) x))))) | |
(lambda (f) | |
(lambda (x) x)))) | |
(define zero | |
(lambda (x) x)) | |
(define one | |
(lambda (f) | |
(lambda (x) | |
(f x)))) | |
(define two | |
(lambda (f) | |
(lambda (x) | |
(f (f x))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment