Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: eb77573c45
Fetching contributors…

Cannot retrieve contributors at this time

file 18 lines (16 sloc) 0.368 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
; The applicative-order Y combinator
;
(define Y
 (lambda (X)
  ((lambda (procedure)
     (X (lambda (arg) ((procedure procedure) arg))))
   (lambda (procedure)
     (X (lambda (arg) ((procedure procedure) arg)))))))

(define F*
 (lambda (func-arg)
  (lambda (n)
    (if (zero? n)
        1
        (* n (func-arg (- n 1)))))))

(define fact (Y F*))
(write (fact 8))
Something went wrong with that request. Please try again.