Skip to content

Instantly share code, notes, and snippets.

@thekindofme
Created December 5, 2014 05:00
Show Gist options
  • Save thekindofme/6dfc78177fb580a45170 to your computer and use it in GitHub Desktop.
Save thekindofme/6dfc78177fb580a45170 to your computer and use it in GitHub Desktop.
C1 E1
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