join
Avi Bryant
avi.bryant at gmail.com
Fri Sep 15 01:31:02 UTC 2006
On Sep 14, 2006, at 6:25 PM, Klaus D. Witzel wrote:
> Hi Keith,
>
> on Fri, 15 Sep 2006 01:57:52 +0200, wrote:
> ...
>> 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?
>
> There are several reasons for the absence of #join:
>
> - the most important one is, that nobody needs it (or else you
> would have found it). Imagine Pearl with the full Squeak Stream
> hierarchy, why use join?
Sure we need it. At Smallthought, we have a package of utility
methods that includes:
SequencableCollection>>joinTokens: aString
^ String streamContents:
[:s |
self do: [:ea | s nextPutAll: ea asString] separatedBy: [s
nextPutAll: aString]]
Looking through my sends to it, the argument is always either ' ' or
', ', so #joinedWithSpaces and #joinedWithCommas would probably be
sensible methods to have too.
Avi
More information about the Squeak-dev
mailing list
|