
12 Dec
2007
12 Dec
'07
11:17 a.m.
On Dec 12, 2007 10:36 AM, Arie Groeneveld
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
One can also use Data.Char.digitToInt in place of (flip (-) 48 . ord). -Brent