Created
March 4, 2013 17:41
-
-
Save orb/5084005 to your computer and use it in GitHub Desktop.
SKI in MUPL in Racket
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
(define S (fun "S" "x" (fun #f "y" | |
(fun #f "z" | |
(call (call (var "x") (var "z")) | |
(call (var "y") (var "z"))))))) | |
(define K (fun "K" "x" (fun #f "y" (var "x")))) | |
(define I (fun "I" "x" (var "x"))) | |
;; SKK | |
(define SKK | |
(call (call S K) K)) | |
;; S(K(SI))K | |
(define SKIrev | |
(call (call S (call K (call S I))) K)) | |
(define SKK2 | |
(call (call (call SKIrev K) S) K)) | |
(eval-exp (call I (int 2))) | |
(eval-exp (call SKK (int 3))) | |
(eval-exp (call SKK2 (int 4))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment