Henning Thielemann wrote:
factors :: Integer -> Integer -> Bool
factors m n | m == n = False
            | m < n  = divides m n || factors (m+1) n


Btw. I find the recursion harder to understand than the explicit
definition:

factors n = any (divides n) [2..(n-1)]

For what it's worth, I also found this function un-intuitive. What I'd expect a function called "factors" to do is exactly what yours does, and not what the one in the example does.

Cheers,
Daniel.
--
     /\/`) http://oooauthors.org
    /\/_/  http://opendocumentfellowship.org
   /\/_/
   \/_/    I am not over-weight, I am under-tall.
   /
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to