Skip to content

Instantly share code, notes, and snippets.

@KirinDave
Created July 16, 2009 06:22
Show Gist options
  • Select an option

  • Save KirinDave/148257 to your computer and use it in GitHub Desktop.

Select an option

Save KirinDave/148257 to your computer and use it in GitHub Desktop.
#lang scheme
; Brace yourself
(define Z
(lambda (f)
((lambda (x) (f (lambda (y) ((x x) y)))) (lambda (x) (f (lambda (y) ((x x) y)))))))
((Z (lambda (f)
(lambda (x) ; Our factorial definition begins here, f is the recursive call
(cond
[(zero? x) 1]
[else (* x (f (- x 1)))])))) 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment