Name: Anonymous 2015-04-26 21:07
I've never really understood the Y combinator.
(define (y f) (f (y f)))
(define (y f)
;; always pass a copy of this function to itself
(let ((make-wrapped-func (lambda (wrapper-maker)
(lambda (arg) ;; original function's argument
;; next-wrapped-func is equivalent to the function we're current evaluationg
(let ((next-wrapped-func (wrapper-maker wrapper-maker)))
;; call original func with wrapped func (which will in turn call it again with a wrapped func, if necessary)
;; then pass in the argument
((f next-wrapped-func) arg))))))
(make-wrapped-func make-wrapped-func)))