[Pharo-dev] Bag enhancements

Gabriel Cotelli g.cotelli at gmail.com
Mon Aug 12 09:03:39 EDT 2013


+1
Keep it consistent with the rest of the system.

On Mon, Aug 12, 2013 at 4:40 AM, Esteban Lorenzano <estebanlm at gmail.com>wrote:

> #withOccurrencesDo: matches better the rest of the pharo system
> (#withIndexDo:, etc) :)
>
> On Aug 12, 2013, at 9:16 AM, Stéphane Ducasse <stephane.ducasse at inria.fr>
> wrote:
>
>
> On Aug 12, 2013, at 1:49 AM, Gabriel Cotelli <g.cotelli at gmail.com> wrote:
>
> Why not #doWithOccurrences: ??
>
>
> ok it was a proposal for a new selector :)
>
>
> Eg:
> bag doWithOccurrences: [:element :count | "do something"]
>
> I dont'like the keysAndValuesDo: idea, is just an implementation detail.
>
>
> On Sun, Aug 11, 2013 at 4:52 PM, Stéphane Ducasse <
> stephane.ducasse at inria.fr> wrote:
>
>> Hi guys
>>
>> I was surprised to see the API of bag for iteration.
>>
>> I propose to add
>>
>> keysAndValuesDo: aBlock
>>         "Iterate over the receiver and apply a two argument block on the
>> element and its occurrences."
>>
>>         contents associationsDo: [:assoc | aBlock value: assoc key value:
>> assoc value ]
>>
>> and
>>
>> elementsAndOccurrencesDo: aTwoArgBlock
>>         "Iterate over the receiver and apply a two argument block on the
>> element and its occurrences."
>>
>>         contents associationsDo: [:assoc | aTwoArgBlock value: assoc key
>> value: assoc value ]
>>
>> Once we agree I will add a bug entry.
>>
>> Stef
>>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20130812/1ba27f0c/attachment-0002.html>


More information about the Pharo-dev mailing list