[BUG][FIX] with: collect: fails on uneven size collections
peter.smet at flinders.edu.au
Tue Aug 31 07:10:29 UTC 1999
Sequenceable collection with: do: had a bug in that it would fail
work with uneven size collections. This bug has been fixed, but
the same bug applies to >>with: collect:
The fix is the same, and is included below:
with: otherCollection collect: twoArgBlock
"Collect and return the result of evaluating twoArgBlock with corresponding
elements from this collection and otherCollection."
| result |
otherCollection size = self size ifFalse: [self error: 'otherCollection
must be the same size'].
result _ self species new: self size.
1 to: self size do:
[:index | result at: index put:
value: (self at: index)
value: (otherCollection at: index))].
More information about the Squeak-dev