Collection.st
changeset 16075 4a15dc058fbe
parent 16068 6cac0ecd5d95
child 16172 68c4859fc136
--- a/Collection.st	Wed Feb 19 15:12:30 2014 +0100
+++ b/Collection.st	Wed Feb 19 17:08:19 2014 +0100
@@ -3407,6 +3407,25 @@
     "
 !
 
+with:aCollection conform:aTwoArgBlock
+    "evaluate the argument, aBlock for successive elements from
+     each the receiver and the argument, aCollection.
+     Return true, if the block returns true for all of these pairs.
+     This method fails if neither the receiver nor aCollection is
+     a sequenceable collection (i.e. implements numeric key access)."
+
+    self with:aCollection do:[:a :b |
+        (aTwoArgBlock value:a value:b) ifFalse:[^ false].
+    ].
+    ^ true.
+
+    "
+     (1 to:3) with:#(1 2 3 4) conform:[:a :b | a = b]   --- raises an error
+     (1 to:3) with:#(1 22 3) conform:[:a :b | a = b]  
+     (1 to:3) with:#(1 2 3) conform:[:a :b | a = b]  
+    "
+!
+
 with:aCollection contains:aTwoArgBlock
     "evaluate the argument, aBlock for successive elements from
      each the receiver and the argument, aCollection.
@@ -5408,11 +5427,11 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.328 2014-02-18 11:12:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.329 2014-02-19 16:08:19 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.328 2014-02-18 11:12:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.329 2014-02-19 16:08:19 cg Exp $'
 ! !