[iterate-devel]/[series-users] collect-tail ?

Chris Dean ctdean at sokitomi.com
Mon Dec 19 10:59:20 UTC 2005


"Hoehle, Joerg-Cyril" <Joerg-Cyril.Hoehle at t-systems.com> writes:
> a) Either take a code generation approach and create code that latches
> (= delay by one) N times,
>
> b) Or take a functional approach, implement a ring datastructure and
> use that.

Thanks for the great advice.

This is the same reasoning I used.  I have since implemented
collect-tail and series-tail using a ring and I will say that it was
more straight forward to write collect-tail for the iterate system.

> since you're asking similar questions in series-users and
> iterate-devel, 

This is my standard looping question in any language: Read the last N
lines of a file, transform them, filter them, and return the unique
elements.  This is a nice test because (to use Series lingo I didn't
know until recently) it combines on-line and off-line processing.

> I'm starting to wonder whether you're going to write a paper on
> comparisons of some looping frameworks? :-)

:-)

Some papers one might wish to read are the recent Shivers paper [1]
and the Egner paper [2].  They provide a decent overview from a Scheme
perspective.

These papers don't really go into the use of iterators/generators ala
Python, Ruby, and CLU.  (This is the approach where one uses yield in
the generator to return control to the loop.)  It's too bad they don't
delve into iterators because it is a very elegant approach to the
problem (albeit with some performance hurdles).

It would be an interesting problem to write a performant iterator
system in Common Lisp.

Thanks again,
Chris Dean


Footnotes: 

[1]  The anatomy of a loop: a story of scope and control.
     Olin Shivers.
     http://www.cc.gatech.edu/~shivers/citations.html#loop

[2]  Eager Comprehensions in Scheme: The design of SRFI-42
     Sebastian Egner
     http://www.deinprogramm.de/scheme-2005/program.html



More information about the iterate-devel mailing list