Created
December 5, 2014 05:00
-
-
Save thekindofme/6dfc78177fb580a45170 to your computer and use it in GitHub Desktop.
C1 E1
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
lastDigit x = x `mod` 10 | |
dropLastDigit x = x `div` 10 | |
--let toDigits x =if x < 10 | |
-- then 0 | |
-- else (toDigits (dropLastDigit x)) ++ [lastDigit x] | |
toDigits :: Integer -> [Integer] | |
toDigits x | |
| x < 10 = [0] | |
| otherwise = (toDigits (dropLastDigit x)) ++ [lastDigit x] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment