On Fri, 24 Aug 2007, Arie Groeneveld wrote:

I defined several functions for calculating the number
of trailing zero's of n!


tm = sum . takeWhile(>0) . iterate f . f
  where f = flip div 5

This is very elegant! You could also inline 'f'

tm4 = sum . takeWhile(>0) . tail . iterate (flip div 5)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to