Last active
June 25, 2017 00:10
-
-
Save evanrinehart/78a9170fba48521e3fe1c470a2e913da to your computer and use it in GitHub Desktop.
This file contains hidden or 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
data E = S | K | App E E | |
-- big step reduction, eager, may not terminate | |
reduce :: E -> E | |
reduce (App (App K x) y) = reduce x | |
reduce (App (App (App S x) y) z) = | |
let a = reduce x in | |
let b = reduce y in | |
let c = reduce z in | |
reduce (App (App a c) (App b c)) | |
reduce (App x y) = reduce (App (reduce x) (reduce y)) | |
reduce other = other |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment