4652 |
4652 |
4653 with:aSequenceableCollection do:aTwoArgBlock |
4653 with:aSequenceableCollection do:aTwoArgBlock |
4654 "evaluate the argument, aBlock for successive elements from |
4654 "evaluate the argument, aBlock for successive elements from |
4655 each the receiver and the argument, aSequenceableCollection. |
4655 each the receiver and the argument, aSequenceableCollection. |
4656 The second argument, aBlock must be a two-argument block. |
4656 The second argument, aBlock must be a two-argument block. |
4657 The collection argument must implement access via a numeric key and |
4657 The collection argument must implement access via a numeric key |
4658 the sizes must be the same." |
4658 and (new!!) the sizes must be the same." |
4659 |
4659 |
4660 |stop "{ Class: SmallInteger }" | |
4660 |stop "{ Class: SmallInteger }" | |
4661 |
4661 |
4662 stop := self size. |
4662 stop := self size. |
4663 aSequenceableCollection size == stop ifFalse:[ |
4663 aSequenceableCollection size == stop ifFalse:[ |
4664 ^ self error:'collections must be of the same size'. |
4664 NotEnoughElementsSignal raiseRequestErrorString:'collections must be of the same size'. |
4665 ]. |
4665 ]. |
|
4666 |
4666 1 to:stop do:[:index | |
4667 1 to:stop do:[:index | |
4667 aTwoArgBlock value:(self at:index) value:(aSequenceableCollection at:index). |
4668 aTwoArgBlock value:(self at:index) value:(aSequenceableCollection at:index). |
4668 ] |
4669 ] |
4669 |
4670 |
4670 " |
4671 " |
4671 #(one two three four five six) |
4672 #(one two three four five six) |
4672 with:(1 to:10) |
4673 with:(1 to:10) |
4673 do:[:el1 :el2 | Transcript show:el1; space; showCR:el2] |
4674 do:[:el1 :el2 | Transcript show:el1; space; showCR:el2] |
4674 " |
4675 " |
4675 |
4676 |
4676 "Modified: / 30-06-2011 / 12:40:04 / cg" |
4677 "Modified (Format): / 30-06-2011 / 17:39:59 / cg" |
4677 ! |
4678 ! |
4678 |
4679 |
4679 with:aSequenceableCollection doWithIndex:aThreeArgBlock |
4680 with:aSequenceableCollection doWithIndex:aThreeArgBlock |
4680 "evaluate the argument, aBlock for successive elements from |
4681 "evaluate the argument, aBlock for successive elements from |
4681 each the receiver and the argument, aSequenceableCollection. |
4682 each the receiver and the argument, aSequenceableCollection. |