Skip to content

Instantly share code, notes, and snippets.

@orb
Created March 4, 2013 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orb/5084005 to your computer and use it in GitHub Desktop.
Save orb/5084005 to your computer and use it in GitHub Desktop.
SKI in MUPL in Racket
(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