The Trunk: Collections-mt.590.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-mt.590.mcz

commits-2
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.590.mcz

==================== Summary ====================

Name: Collections-mt.590
Author: mt
Time: 14 January 2015, 12:47:06.604 pm
UUID: 5165dd57-c3e5-5d45-9c61-bc820f2fab02
Ancestors: Collections-mt.589

Methods added to easily join split strings.

=============== Diff against Collections-mt.589 ===============

Item was added:
+ ----- Method: SequenceableCollection>>join (in category 'converting') -----
+ join
+ "Example: #(H e l l o W o r l d) join = 'HelloWorld'.  "
+
+ ^ self joinSeparatedBy: ''!

Item was added:
+ ----- Method: SequenceableCollection>>joinSeparatedBy: (in category 'converting') -----
+ joinSeparatedBy: aSeparator
+ "Returns a string, which is a concatenation of each element's string representation separated by another string."
+
+ ^ String streamContents: [:stream |
+ self
+ do: [:ea | stream nextPutAll: ea asString]
+ separatedBy: [stream nextPutAll: aSeparator asString]]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-mt.590.mcz

Bert Freudenberg
On 14.01.2015, at 11:47, [hidden email] wrote:

>
> Marcel Taeumel uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-mt.590.mcz
>
> ==================== Summary ====================
>
> Name: Collections-mt.590
> Author: mt
> Time: 14 January 2015, 12:47:06.604 pm
> UUID: 5165dd57-c3e5-5d45-9c61-bc820f2fab02
> Ancestors: Collections-mt.589
>
> Methods added to easily join split strings.
Nice :)

> =============== Diff against Collections-mt.589 ===============
>
> Item was added:
> + ----- Method: SequenceableCollection>>join (in category 'converting') -----
> + join
> + "Example: #(H e l l o W o r l d) join = 'HelloWorld'.  "
> +
> + ^ self joinSeparatedBy: ''!
>
> Item was added:
> + ----- Method: SequenceableCollection>>joinSeparatedBy: (in category 'converting') -----
> + joinSeparatedBy: aSeparator
> + "Returns a string, which is a concatenation of each element's string representation separated by another string."
> +
> + ^ String streamContents: [:stream |
> + self
> + do: [:ea | stream nextPutAll: ea asString]
> + separatedBy: [stream nextPutAll: aSeparator asString]]!
Any reason against calling the non-parametrized method just "join:"? Is there precedent in other dialects?

- Bert -




smime.p7s (5K) Download Attachment