
Hello Xavier, Thursday, August 23, 2007, 3:08:25 AM, you wrote:
I am learning Haskell with "Programming in Haskell" (an excellent book BTW).
scheme of lazy evaluation called "graph reduction" you may consider it as repetitive replacing right parts of function definitions with their left parts. as far as some part of graph isn't required to compute final result, it's abandoned and not computed down to final value simple example: consider evaluation of "head [1..]". [1..] may be represented with the following recursive function: list n = n:list n+1 so we have "head (list 1)" where head defined as head (x:_) = x let's evaluate expression: head (list 1) => head (1:list 2) => 1 as you see, "list 2" was just dropped during evaluation. the same applies to your case - as far as "==" found different values in list, it skips its further evaluation, so rest of divisors remains uncalculated -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com