Richard J Cox wrote:
On Tuesday, December 10, 2002, 1:26:41 PM, you (mailto:[EMAIL PROTECTED]) wrote:
On 12/10/2002 4:54 AM, Me wrote:
How would one most nicely code what I'll call
a lazy pipeline, such that the first result
from the final element of the pipeline can
appear as soon as the first result has been
processed from the intervening elements?
I belive the short answer is "make sure all elements of your pipeline
return a lazy list". Exactly how one does this, and the distinction
between a lazy list and an iterator, I belive is still somwhat up in the
air.
I think the answer here will be make a lazy list an iterator constructor. This
would also be the case for something like a grep in the pipeline (in effect an
iterator adaptor -- to use a C++ term -- on the previous iterator).
I.e. in a "lazy context", grep would return an object with implementation
something like:
<code snipped>
Not to rain on the parade, but doesn't there also need to be
some sort of global analysis of the whole pipe line before making
any of it lazy. For example, if the pipeline contains a "sort" or
"reduce" it can't be evaluated lazily, so why go to all the bother
of transforing the "grep"s and "map"s to lazy iterator forms?
--
Mark Biggar
[EMAIL PROTECTED]