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')
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to