
12 Dec
2007
12 Dec
'07
6:15 a.m.
On Wed, 12 Dec 2007, Reinier Lamers wrote:
Back in my Introduction to Functional Programming course, Daan Leijen demonstrated how to print integers in Haskell using function composition. Something along the lines of:
printint :: Int -> [Char] printint = map chr . map (+0x30) . reverse . map (`mod` 10) . takeWhile (>0) . iterate (`div`10)
Nice, that is even without 'unfoldr'. It might be a bit better style to use map (+ ord '0')