For me it makes sense that in your example `aBag at: $a` returns `5`

Because as you said, a Bag is for keeping occurrences. So, at: $a should return 
how many occurrences $a has

Sebastian

----- Mail original -----
> De: "Stephane Ducasse" <stephane.duca...@inria.fr>
> À: "Pharo Development List" <pharo-dev@lists.pharo.org>
> Envoyé: Dimanche 23 Octobre 2022 09:27:45
> Objet: [Pharo-dev] Re: About Bag API

> it is because at: is in fact occurrencesOf:
> 
> S
> 
>> On 23 Oct 2022, at 11:26, stephane ducasse <stephane.duca...@inria.fr> wrote:
>> 
>> Hi
>> 
>> I wonder why I cannot get values of a entry using at:
>> 
>> | aBag |
>> aBag := Bag new.
>> aBag addAll: ‘aabbbacaccca’.
>> aBag at: $a
>>>>> 5
>> 
>> I have the impression that this is because Bag API never got the correct 
>> amount
>> of love
>> but may be I’m wrong.
>> 
>> What is your opinion?
>> 
> > S

Reply via email to