> > If xs is finite, your version of zipWith would evaluate the infinite
> > list [1..] one place beyond that which was really needed.
> 
> Sure, there is a single extra amount of evaluation needed to work out if
> there is a following list item (I guess this could be quite high in more
> complex cases - is this the reason?)

Consider 1:2:if (2^2^2241 - 1) `mod` p == 0
             then [p]
             else []

or whatever. The cost of determining whether there is
another member of a list can be arbitrarily (up to infinite)
large.

-- 
Jón Fairbairn                                 [EMAIL PROTECTED]
31 Chalmers Road                                         [EMAIL PROTECTED]
Cambridge CB1 3SZ            +44 1223 570179 (after 14:00 only, please!)



_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to