Created
November 6, 2013 05:34
-
-
Save ijp/7331432 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; shift-reset fixed point combinator | |
(use-modules (ice-9 control)) | |
(define (fix f) | |
(reset | |
(let ((g (shift k (k k)))) | |
(lambda (x) | |
((f (g g)) x))))) | |
(define fact | |
(lambda (fact) | |
(lambda (x) | |
(if (zero? x) | |
1 | |
(* x (fact (- x 1))))))) | |
((fix fact) 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment