-
-
Save nitrix/d63fca1e94a3fd4bfff3019d0cb29241 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