Last active
October 31, 2018 20:55
-
-
Save Solonarv/2dd9edc4a496d439bab44d1a06d0a42b 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
module SKI where | |
data SKI = S | K | I | A SKI SKI | |
deriving (Eq, Show) | |
reduce :: SKI -> SKI | |
reduce (A (A (A S x) y) z) = reduce (A (A x z) (A y z)) | |
reduce (A (A K x) y) = reduce y | |
reduce (A I x) = reduce x | |
reduce a@(A f x) = let f' = reduce f in if f==f' then a else reduce (A f' x) | |
reduce a = a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment