Comment #2 on issue 3761 by [email protected]: overlappingPairsCollect: fails on OrderedCollections
http://code.google.com/p/pharo/issues/detail?id=3761

Need to change #at:put: to rather be #add:.

The reason for this is explained in comment of OrderedCollection>>at:put:
"Put anObject at element index anInteger. at:put: cannot be used to append, front or back, to an ordered collection; it is used by a knowledgeable client to replace an element."

Change could be as given below...

overlappingPairsCollect: aBlock
"Answer the result of evaluating aBlock with all of the overlapping pairs of my elements."
        | retval |
        retval := self species new: self size - 1.
        1 to: self size - 1
do: [:i | retval add: (aBlock value: (self at: i) value: (self at: i + 1)) ].
        ^retval


Reply via email to