Last active
May 28, 2016 11:20
-
-
Save gdejohn/81ffafefc0ab50baa8ee to your computer and use it in GitHub Desktop.
This file contains 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
import Control.Applicative (liftA2) | |
import Control.Monad (guard) | |
import Data.Functor ((<$)) | |
import Data.List (unfoldr) | |
import Data.Tuple (swap) | |
digits :: Integer -> [Integer] | |
digits = reverse . unfoldr (liftA2 (<$) (swap . (`divMod` 10)) (guard . (> 0))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment