Collection.st
changeset 23376 4e16654d11fe
parent 23339 e6991383873a
child 23377 bd1fedce09ef
--- a/Collection.st	Sat Sep 22 11:02:29 2018 +0200
+++ b/Collection.st	Sat Sep 22 11:19:14 2018 +0200
@@ -297,8 +297,6 @@
     ^ self newWithSize:n
 ! !
 
-
-
 !Collection class methodsFor:'Signal constants'!
 
 emptyCollectionSignal
@@ -360,7 +358,6 @@
     ^ self == Collection
 ! !
 
-
 !Collection methodsFor:'Compatibility-ANSI'!
 
 identityIncludes:anObject
@@ -370,7 +367,6 @@
     ^ self includesIdentical:anObject.
 ! !
 
-
 !Collection methodsFor:'Compatibility-Squeak'!
 
 , aCollection
@@ -531,7 +527,6 @@
     ^ self ifEmpty:ifEmptyValue ifNotEmpty:ifNotEmptyValue
 ! !
 
-
 !Collection methodsFor:'accessing'!
 
 anElement
@@ -2708,6 +2703,21 @@
     "
 !
 
+collectColumn:columnNumber
+    "for each row-element in the receiver (which ought to be sequencable), 
+     retrieve the indexed element at columnNumber,
+     and return a new collection with those column values"
+
+    ^ self collect:[:el | el at:columnNumber].
+
+    "
+     #((1 one) (2 two) (3 three) (4 four)) collectColumn:1
+     #((1 one) (2 two) (3 three) (4 four)) collectColumn:2
+    "
+
+    "Created: / 22-09-2018 / 11:18:37 / Claus Gittinger"
+!
+
 collectWithIndex:aTwoArgBlock
     "for each element in the receiver and a running index, 
      evaluate the argument, aTwoArgBlock.
@@ -6339,7 +6349,6 @@
     ^ aVisitor visitCollection:self with:aParameter
 ! !
 
-
 !Collection class methodsFor:'documentation'!
 
 version