Created
January 22, 2015 11:07
-
-
Save auduchinok/4d48c88a24fd401c5eb2 to your computer and use it in GitHub Desktop.
Haskell Exam
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
revert :: L a -> L a | |
revert N = N | |
revert (O a x b) = O (revert b) x (revert a) | |
revert (E a b) = E (revert b) (revert a) | |
instance (Show a) => Show (L a) where | |
show N = "[]" | |
show x = "[" ++ (init $ show' x) ++ "]" where | |
show' N = "" | |
show' (E a b) = show' a ++ show' b | |
show' (O a x b) = show' a ++ show x ++ "," ++ show' b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment