Last active
December 24, 2015 20:09
-
-
Save qoelet/6855857 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
destruct :: Integer -> [Integer] | |
destruct 0 = [] | |
destruct x = destruct (x `div` 10) ++ [(x `mod` 10)] | |
construct :: [Integer] -> Integer | |
construct [] = 0 | |
construct (x:xs) = (x * (10 ^ (length xs))) + construct xs | |
-- *Main> construct (destruct 123456) | |
-- 123456 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment