diff -r 90cedbae4e5b -r ffb4208adfe8 SequenceableCollection.st --- a/SequenceableCollection.st Mon Feb 03 01:48:41 2020 +0100 +++ b/SequenceableCollection.st Mon Feb 03 02:34:03 2020 +0100 @@ -440,6 +440,8 @@ ^ self == SequenceableCollection ! ! + + !SequenceableCollection methodsFor:'Compatibility-Squeak'! allButFirst @@ -738,6 +740,7 @@ ^ self replaceFrom:start to:stop with:anArray startingAt:repStart ! ! + !SequenceableCollection methodsFor:'accessing'! after:anObject @@ -3613,6 +3616,18 @@ "Modified (comment): / 16-11-2016 / 21:35:36 / cg" ! +copyReplaceAllForWhich:checkBlock with:newElement + "return a copy of the receiver, where all elements for which checkBlock + returns true will are replaced by newElement." + + ^ (self copyFrom:1) replaceAllForWhich:checkBlock with:newElement + + " + #(1 2 1 3 4 5 1 2 1 2) copyReplaceAllForWhich:[:e | e > 2] with:99 + 'hello 1234 world' copyReplaceAllForWhich:#isDigit with:$* + " +! + copyReplaceAllSubcollections:subColl with:newColl "return a copy of the receiver, with all sequences of subColl replaced by newColl (i.e. slice in the newColl in place of the subColl)." @@ -8032,6 +8047,7 @@ "Created: 14.2.1997 / 16:13:03 / cg" ! ! + !SequenceableCollection methodsFor:'searching'! asMapAt:key ifAbsent:exceptionValue