Skip to content

Instantly share code, notes, and snippets.

@incompl
Created February 7, 2014 17:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save incompl/8867389 to your computer and use it in GitHub Desktop.
(define (Y f)
((lambda (x) (x x))
(lambda (g)
(f (lambda args (apply (g g) args))))))
(define fac
(Y
(lambda (f)
(lambda (x)
(if (< x 2)
1
(* x (f (- x 1))))))))
(fac 5) ; 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment