Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.591.mcz
==================== Summary ====================
Name: Collections-mt.591
Author: mt
Time: 14 January 2015, 1:13:09.966 pm
UUID: 8d73a22f-0d76-1f4a-82b7-53900b5f3be1
Ancestors: Collections-mt.590
Added #flatten as special case for #concatenation to remove any nesting except for strings. Very simple implementation with streams and recursion but not as efficient as #concatenation.
=============== Diff against Collections-mt.590 ===============
Item was added:
+ ----- Method: SequenceableCollection>>flatten (in category 'converting') -----
+ flatten
+ "Similar to #concatenation but removes all nesting except for strings.
+ Example: {3 .4 .{2 .4 .{'hi'} .'ho'}} flatten = {3 .4 .2 .4 .'hi' .'ho'}"
+
+ ^ Array streamContents: [:stream |
+ self do: [:each |
+ (each isCollection and: [each isString not])
+ ifFalse: [stream nextPut: each]
+ ifTrue: [stream nextPutAll: each flatten]]]!
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.591.mcz
==================== Summary ====================
Name: Collections-mt.591
Author: mt
Time: 14 January 2015, 1:13:09.966 pm
UUID: 8d73a22f-0d76-1f4a-82b7-53900b5f3be1
Ancestors: Collections-mt.590
Added #flatten as special case for #concatenation to remove any nesting except for strings. Very simple implementation with streams and recursion but not as efficient as #concatenation.
=============== Diff against Collections-mt.590 ===============
Item was added:
+ ----- Method: SequenceableCollection>>flatten (in category 'converting') -----
+ flatten
+ "Similar to #concatenation but removes all nesting except for strings.
+ Example: {3 .4 .{2 .4 .{'hi'} .'ho'}} flatten = {3 .4 .2 .4 .'hi' .'ho'}"
+
+ ^ Array streamContents: [:stream |
+ self do: [:each |
+ (each isCollection and: [each isString not])
+ ifFalse: [stream nextPut: each]
+ ifTrue: [stream nextPutAll: each flatten]]]!
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.591.mcz
==================== Summary ====================
Name: Collections-mt.591
Author: mt
Time: 14 January 2015, 1:13:09.966 pm
UUID: 8d73a22f-0d76-1f4a-82b7-53900b5f3be1
Ancestors: Collections-mt.590
Added #flatten as special case for #concatenation to remove any nesting except for strings. Very simple implementation with streams and recursion but not as efficient as #concatenation.
=============== Diff against Collections-mt.590 ===============
Item was added:
+ ----- Method: SequenceableCollection>>flatten (in category 'converting') -----
+ flatten
+ "Similar to #concatenation but removes all nesting except for strings.
+ Example: {3 .4 .{2 .4 .{'hi'} .'ho'}} flatten = {3 .4 .2 .4 .'hi' .'ho'}"
+
+ ^ Array streamContents: [:stream |
+ self do: [:each |
+ (each isCollection and: [each isString not])
+ ifFalse: [stream nextPut: each]
+ ifTrue: [stream nextPutAll: each flatten]]]!
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]]!
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]]!
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]]!