[Haskell-cafe] Folding Integrals

Arie Groeneveld bradypus at xs4all.nl
Wed Dec 12 10:36:38 EST 2007


Reinier Lamers schreef:
>
> printint :: Int -> [Char]
> printint = map chr . map (+0x30) . reverse . map (`mod` 10) .
> takeWhile (>0) . iterate (`div`10)
>
Most of the time I use this:

digits :: Integer -> [Int]
digits = map (flip(-)48.ord) . show



Regards

=@@i



More information about the Haskell-Cafe mailing list