set and stream

Houssam Fakih fakih at ensm-douai.fr
Mon Aug 1 08:12:12 UTC 2005


Hi,

>-----Message d'origine-----
>De : squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
>bounces at lists.squeakfoundation.org] De la part de Michael van der Gulik
>Envoyé : samedi 30 juillet 2005 02:09
>À : squeak-dev at lists.squeakfoundation.org
>Objet : Re: set and stream
>
>Houssam Fakih wrote:
>> Hello,
>>
>>
>>
>> I’m trying to concatenate many collections (sets) together. I learn
>> (from beck’s book) that the use of stream is efficient so I try the
>> following code
>>
>>
>>
>> write _ WriteStream on: Set new.
>>
>> write nextPutAll: (Set with:4 with:5)
>>
>> write contents
>>
>>
>>
>> but it doesn’t work because Set isn’t a member of a
>> SequenceableCollection then it doesn’t understand the message :
>> replaceFrom:to:with:startingAt:
>>
>>
>>
>> Finally I try a code as:
>>
>> write _ WriteStream on: {}.
>>
>> write nextPutAll: (Set with:4 with:5)
>>
>> write contents asSet
>>
>>
>>
>> I’m happy with the result but I need just to know if there is another
>> pattern to use Set and Stream.
>
>I'm not entirely sure what you're trying to do, but:
>
>a := Set with: 1 with: 'a' with: #hello.
>b := Set with: 2 with: 'b' with: #world.
>c := Set new.
>c addAll: a.
>c addAll: b.
>
>Is that what you want? Remember to look at the Set class and see what it
>can do.
[Fakih] 

Thank you for your response. What I need is a method that does the same
computation as addAll: with better performance. By using streams I improve
the performance by 70%. My question was just to know if the developers on
the list use another pattern (other than using streams) to improve that.

Thanks,
Houssam


>
>Mikevdg.
>






More information about the Squeak-dev mailing list