#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Thu, 02 May 2019 21:02:22 +0200
changeset 24105 249b30888105
parent 24104 d5fa45826506
child 24106 57fa3fced677
#FEATURE by cg class: SequenceableCollection added: #from:doWithIndex:
SequenceableCollection.st
--- a/SequenceableCollection.st	Thu May 02 14:32:16 2019 +0200
+++ b/SequenceableCollection.st	Thu May 02 21:02:22 2019 +0200
@@ -4997,6 +4997,22 @@
     "Created: / 28-07-2013 / 22:37:28 / cg"
 !
 
+from:startIndex doWithIndex:aTwoArgBlock
+    "evaluate the argument, aTwoArgBlock for the elements starting with the
+     element at startIndex to the end,
+     passing both the element and its index as argument."
+
+    ^ self from:startIndex to:self size doWithIndex:aTwoArgBlock
+
+    "
+     #(one two three four five six)
+        from:3
+        doWithIndex:[:element :idx | Transcript showCR:idx->element]
+    "
+
+    "Created: / 02-05-2019 / 21:01:44 / Claus Gittinger"
+!
+
 from:startIndex keysAndValuesDo:aBlock
     "evaluate the argument, aBlock for the elements and indices starting with the
      element at startIndex to the end."