join

Todd Blanchard tblanchard at mac.com
Fri Sep 15 16:21:15 UTC 2006


I'll just mention that mine are modeled on the NextStep routines

NSString>>componentsSeparatedByString:
NSArray>>componentsJoinedByString:

they behave exactly the same way.




On Sep 15, 2006, at 8:37 AM, stephane ducasse wrote:

> 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