Comment #3 on issue 3761 by [email protected]:
overlappingPairsCollect: fails on OrderedCollections
http://code.google.com/p/pharo/issues/detail?id=3761
Except that it would then fail if the receiver was an Array, for instance.
The following should work though:
overlappingPairsCollect: aBlock
"Answer the result of evaluating aBlock with all of the overlapping pairs
of my elements."
| retval |
retval := self species ofSize: self size - 1.
1 to: self size - 1
do: [:i | retval at: i put: (aBlock value: (self at: i) value: (self at:
i + 1)) ].
^retval