Strict functions

Jon Fairbairn Jon.Fairbairn@cl.cam.ac.uk
Sun, 21 Oct 2001 13:28:14 +0100


> > 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 i=
f
> there is a following list item (I guess this could be quite high in mor=
e
> complex cases - is this the reason?)

Consider 1:2:if (2^2^2241 - 1) `mod` p =3D=3D 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=F3n Fairbairn                                 Jon.Fairbairn@cl.cam.ac.u=
k
31 Chalmers Road                                         jf@cl.cam.ac.uk
Cambridge CB1 3SZ            +44 1223 570179 (after 14:00 only, please!)