Skip to content
Prev 63154 / 63424 Next

An iteration protocol

Great stuff, and I like the use of a sentinel as a terminator symbol.

One aspect of this I would like to explore is that of a lazy sequence as a more fundamental language primitive. Generators in for loops are great, but generators returned by lapply() and friends would enable lazy functional transformations and efficient combination of processing steps. At the lowest level I can see this being facilitated by an ALTREP protocol with a similar API to what you propose. 

One big pain point of course is parallel processing. A two level design splitting the iterator index and data generation (like C++ does)  could be a better fit if parallelization is desired. Curious to hear your thoughts. 

Best, 

Taras