join

stephane ducasse stephane.ducasse at gmail.com
Fri Sep 15 15:37:29 UTC 2006


Oscar and Damien did an implementation of join and split and I would  
really like to ease
perl people and include such protocols in the next release (with tests)
Now if would be nice to have a discussion on the implementations

http://bugs.impara.de/view.php?id=4874

> I came up with
>
> SequencableCollection>>join: aCollection
>
>    ^ self class streamContents: [ :stream |
>        aCollection
>            do: [ :each | stream nextPut: each ]
>            separatedBy: [ stream nextPutAll: self ] ]
>
>
> and
>
> Character>>join: aCollectionOfStrings
>
>    ^ self class streamContents: [ :stream |
>        aCollectionOfStrings
>            do: [ :each | stream nextPutAll: each ]
>            separatedBy: [ stream nextPut: self ] ]
>
> and
>
> Collection>>joinWith: aCollection
>
> aCollection join: self
>
> ----
> This now allows
> (Array with: 1 with: 2) join: (Array with: 3 with: 4 with: 5)
> $/ join: (Array with: 'Hello' with: 'my' with: 'World').
>
> any thoughts? I am curious as to why #join: hasn't made it into the  
> core image, and if it were to how would it happen?
>
> Keith
>
> 		
> ___________________________________________________________ The all- 
> new Yahoo! Mail goes wherever you go - free your email address from  
> your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
>




More information about the Squeak-dev mailing list