[squeak-dev] Anyone else want these in trunk? Anyone not want these in trunk?

Eliot Miranda eliot.miranda at gmail.com
Fri Jul 31 18:56:57 UTC 2020


SequenceableCollection methods for accessing
indicesOfSubCollection: aSubCollection
"Answer an Array (possibly empty) of all the indices of aSubCollection in
the receiver."

^self indicesOfSubCollection: aSubCollection startingAt: 1

indicesOfSubCollection: aSubCollection startingAt: initialIndex
"Answer an Array (possibly empty) of all the indices of aSubCollection in
the receiver starting at
initialIndex. N.B. This does not (yet) use Boyer-Moore to skip over
unnecessary alignments."

^Array streamContents:
[:s| | index |
index := initialIndex - 1.
[(index := self indexOfSubCollection: aSubCollection startingAt: index + 1)
= 0] whileFalse:
[s nextPut: index]]
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200731/5a052dbb/attachment.html>


More information about the Squeak-dev mailing list