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

Ron Teitelbaum ron at usmedrec.com
Fri Jul 31 22:16:43 UTC 2020


'this is great' indicesOfSubCollection: 'is' #(3 6)

:)
Ron

On Fri, Jul 31, 2020 at 4:59 PM Chris Muller <asqueaker at gmail.com> wrote:

> Hi Eliot,
>
> I have no opinion about the inclusion of the methods, only about the
> variable name "aSubCollection".  Anytime I see a variable named with prefix
> "a" or "an", I consider what follows to be a class in the system.  In fact,
> the IDE does, too, which is why you can simply double-click on the argument
> and it'll open a browser on that class.  Since "SubCollection" is already
> part of the selector, "aCollection" seems like it should be a fine
> argument.  Otherwise, "subCollection" (as in the legacy method you're
> calling) or "aSequenceableCollection".
>
> Best,
>   Chris
>
>
> On Fri, Jul 31, 2020 at 1:57 PM Eliot Miranda <eliot.miranda at gmail.com>
> wrote:
>
>>
>> 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/cc8c5875/attachment.html>


More information about the Squeak-dev mailing list