21 Oct
2001
21 Oct
'01
5:58 p.m.
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 Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)