Skip to content

Instantly share code, notes, and snippets.

@cacharle
Created August 18, 2019 09:19
Show Gist options
  • Save cacharle/dfa73b73a2146f58552a7ef5b1ce3e26 to your computer and use it in GitHub Desktop.
Save cacharle/dfa73b73a2146f58552a7ef5b1ce3e26 to your computer and use it in GitHub Desktop.
digits :: Int -> [Int]
digits x = reverse $ revDigits x
revDigits :: Int -> [Int]
revDigits 0 = []
revDigits x = x `mod` 10 : revDigits (x `div` 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment