Of Jim Menard
The comment for OrderedCollection>before:ifAbsent: states, in part, "Answer the result of evaluating the exceptionBlock if ... there are no elements before it."
The code, however, performs self errorFirstObject: target if the object is the first element of the collection.
Which should be changed: the code or the comment?
Patch 6159 in 3.9 has the fix (this can also be applied to 3.7) SequenceableCollection>>before: target ifAbsent: exceptionBlock "Answer the receiver's element immediately before target. Answer the result of evaluating the exceptionBlock if target is not an element of the receiver, or if there are no elements before it."
| index | index _ self indexOf: target. ^ (index == 0 or: [index == 1]) ifTrue: [exceptionBlock value] ifFalse: [self at: index - 1]