Great! I'll add that
aSeqCollect atAll: anInterval
is a powerfully expressive idiom
Fully agreed -- to the point that I was surprised of its absence.
enabled by this extension, replacing
all sorts of specialized collection methods
What are you thinking of?
I should add that MappedCollection is also a powerful tool with this
respect, since basically
MappedCollection collection: foo map: aCollection
is a lazy version of "foo atAll: aCollection". For Intervals, using a
MappedCollection may save lots of memory.
An interesting example is that of matrices, implemented over a single
array with rows*cols elements:
initialize
rowSections := (0 to: rows - 1) collect: [ :n |
MappedCollection
collection: data
map: (n * cols + 1 to: (n + 1) * cols) ].
columnSections := (1 to: cols) collect: [ :n |
MappedCollection
collection: data
map: (n to: rows * cols by: cols) ].
at: n
^rowSections at: n
columnAt: n
^columnSections at: n
at: row at: column
^(self at: row) at: column
Paolo
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk