Skip to content

Instantly share code, notes, and snippets.

@ayato-p
Created March 14, 2013 03:55
Show Gist options
  • Save ayato-p/5158698 to your computer and use it in GitHub Desktop.
Save ayato-p/5158698 to your computer and use it in GitHub Desktop.
(define Y
(lambda (f)
((lambda (x) (x x))
(lambda (x)
(f (lambda (y) ((x x) y)))))))
(define add
(Y (lambda (add)
(lambda (tup)
(cond
((zero? (car (cdr tup))) (car tup))
(else (add (cons (+ (car tup) 1)
(cons
(- (car (cdr tup)) 1) '())))))))))
(add '(10 20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment