Revisions
-
Solonarv revised this gist
Oct 31, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,5 +7,5 @@ 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 -
Solonarv revised this gist
Oct 31, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,5 +7,5 @@ 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' reduce a = a -
Solonarv created this gist
Oct 31, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ 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 x y) = let a' = A (reduce x) (reduce y) in if a==a' then a else reduce a' reduce a = a