logo       

Re: using collect on a ReadStream: msg#00093

lang.smalltalk.squeak.beginners

Subject: Re: using collect on a ReadStream


Strange. I do not see these methods supported by ReadStream in my image.

I only see 13 implementors of #collect:

What does your implementation of ReadStream>>collect: say?

Oscar

On Oct 30, 2007, at 8:20, Norbert Hartl wrote:


On Tue, 2007-10-30 at 08:03 +0100, Oscar Nierstrasz wrote:
Hi Norbert,

Streams don't support the collection protocols. You can convert a
stream to a collection by sending #contents to the stream:

stream := (ReadStream on: #( #(#a #b) #(#b #c))).
stream contents collect: [:each| 'k',each first] --> #('ka' 'kb')

Is that what you want?

Sure, it works :) What I do not understand is that a lot of the
collection protocol is in ReadStream. It has detect: select:
collect: includes: ... What is it for?

thanks,

Norbert

_______________________________________________
Beginners mailing list
Beginners@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://lists.squeakfoundation.org/mailman/listinfo/beginners


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise