Skip to content

Instantly share code, notes, and snippets.

@incompl
Created February 7, 2014 17:19
Show Gist options
  • Save incompl/8867389 to your computer and use it in GitHub Desktop.
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