It is also worth mentioning that there is now also the Cons library available
through the Pharo6 catalog browser. Cons is a lazy linked list that can be
used like a normal linked list, but can also be used as an iterator over
streams or infinite-sequence-generating blocks, using the usual Pharo
collections API.

myStream := (1 to: 100) readStream.
(myStream asCons take: 5) do: [ ... ].

Due to the laziness, Cons, like Clojure's transducers, doesn't build
intermediate representations, so things like #selectThenCollect: aren't
necessary. 

(myList select: sBlock) collect: cBlock

 just creates an iterator and never actually creates the whole list,
although you can still treat it like a list with #first, #allButRest, etc. 

The code is stable and in use in several of my projects. 

Evan



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply via email to