Hi Jason, Conrad
On Nov 14, 7:35 pm, Jason Stidd <
stiddsg...@gmail.com> wrote:
> From the point of view of Haskell, the benefit of the lazy list is not
> to shorten the list, but to only calculate what you need. The list may
> be large (in fact you can use infinite lists with lazy evaluation),
> but if you only evaluate or look at what you need, its faster. If I
> have a list of 1000 items and I only need the car or the first five
> items for instance, there's no reason to look at all 1,000 items.
> Especially if I'm going to be looking at the list three or four times.
> And in addition, it won't be evaluated until we absolutely need it.
> This is a huge benefit if for some reason we don't end up needing to
> evaluate it all. I hope this helps.
I'm not familiar with Haskell, but I'm sure it cannot have an infinite
lazy list with all those items actually present. And even with non-
lazy lists, if you only need the first 5 items, you don't have to
look at all 1000 items either (unless you want the last 5 items -- but
then a lazy list would not be better off).
I think this is in line with Conrad's reply to my question, where he
states that
> Even though the data generated by step 1 may be prohibitively large,
> we actually only calculate possible moves on an "as needed" basis.
> This would only be possible by performing the calculations in step 1
> in a lazy manner.
But my original question remains: what is the use of MAKE-LAZY? It
converts an *existing* list, with *all data present*, into a lazy
list, a system which is designed to only generate the data needed.
Note that I'm not questioning the purpose of lazy lists; I'm
questioning the usefulness of MAKE-LAZY (other than educational).
Cheers,
Peter.