Hi Fabian,

Welcome on board ;-)

Set: I represent a set of objects without duplicates.
so if you have the same number multiple times, it cannot be added more than
once in the Set.

replace Set by Bag (I represent an unordered collection of possibly
duplicate elements.) and the size will  always be 10.

Best,

Luc



#Luc


2014-06-14 11:48 GMT+02:00 Fabian Boucsein <fabian.boucs...@googlemail.com>:

> Hi there,
>
> i am new to Smalltalk and Pharo and today, while
> trying out some examples, i observed an somewhat
> strange behaviour.
>
> I used this snippet from the pharo.org website:
>
> | numbers |
> numbers := Set new.
> 10 timesRepeat: [ numbers add: 100 atRandom ].
> numbers explore.
>
> Using Pharo 3.0 on my Laptop with Manjaro Linux 32bit and copy
> pasting the snippet above into the workspace i get sometimes
> a set with 10 values, sometimes with 9 values and once a set
> with just 8 values.
>
> Using this snippet, just to test the timesRepeat message:
> 10 timesRepeat: [ Transcript show: (100 atRandom); cr. ].
> i always get 10 values.
>
> Is the behaviour with the first snippet correct? Giving sometimes
> 10 or 9 or even 8 values. Or is it a bug? I would expect to always
> get 10 values in my set.
>
> By the way i am totally excited about your cool programming
> environment. Keep on the good work. I justed started to explore
> it and can say it is awesome to work with.
>
> Kind regards,
> Fabian
>
>

Reply via email to