[Haskell-cafe] How to calculate de number of digits of an integer? (was: Is logBase right?)

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Aug 22 13:45:37 EDT 2009


Hello Roberto,

Saturday, August 22, 2009, 9:19:26 PM, you wrote:

> I want to calculate the number of digits of a positive integer. I was

fastest way

digits = iterate (`div` 10) >>> takeWhile (>0) >>> length


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list