join

Keith Hodges keith_hodges at yahoo.co.uk
Mon Oct 2 17:13:19 UTC 2006


Thanks JJ, I think I prefer this option overall. Sorry I just havent had 
any time to do anything about writing tests etc as requested.

Keith

J J wrote:
> Ok, I went and dug it up.  I think this was the best proposal for 
> adding "join" to Squeak 3.10.
>
>
>> From: Keith Hodges <keith_hodges at yahoo.co.uk>
>> Reply-To: The general-purpose Squeak developers 
>> list<squeak-dev at lists.squeakfoundation.org>
>> To: The general-purpose Squeak developers 
>> list<squeak-dev at lists.squeakfoundation.org>
>> Subject: Re: join
>> Date: Sat, 16 Sep 2006 01:54:50 +0100
>>
>> I think that join: should be more than a simple string generator. 
>> Using the power of Smalltalk collections you will find all sorts of 
>> wierd and wonderful operators that work on all manner of collections, 
>> and I think that join: should demonstrate some of this power.
>>
>> avi's joinTokens: aStringToken does just what it say it does, it just 
>> creates a string. Simple and unambiguous.
>>
>> My proposed join: implementation is able to do much more, but there 
>> are some ambiguities as to what behaviour is desired/obtained. I have 
>> no idea what other Smalltalks do but here are my ideas so far:
>>
>> Character-useTojoin: result will be a string.
>> String-useToJoin: result will be a string.
>> $/ useToJoin: #('hello' 'my' 'world')   -> 'hello/my/world'
>> ', ' useToJoin: #('hello' my' 'world') -> 'hello, my, world'
>>
>> SequencableCollection-useToJoin result will be a SequencableCollection.
>> #(1 2) useToJoin: #(3 4 5) ->  #(3 1 2 4 1 2 5)
>>
>> The double dispatch approach can be used.
>>
>> #('hello' 'my' world') joinUsing: $/
>>
>> SequenceableCollestion>>joinUsing: joiner
>> ^ joiner useToJoin: self
>>
>> ----
>> ideas:
>>
>> useToJoin:  <-> joinUsing:
>> join: <-> joinWith:
>>
>> Keith
>>

		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html



More information about the Squeak-dev mailing list