Jon Hylands jon@huv.com wrote:
On Tue, 30 Nov 2004 12:32:36 -0800, Tim Rowledge tim@sumeru.stanford.edu wrote:
Can anyone explain the VA primitive mentioned?
BlockContext >> #apply: aCollection from: start to: end "Evaluate the receiver for each variable slot of aCollection from start to end. Answer aCollection."
<primitive: VMprBlockContextApplyFromTo> start to: end do: [:i | self value: (aCollection basicAt: i)]. ^aCollection
Ah, I see. So I guess that OrderedCollection does it in two slices if the start/stop have wrapped around in stacklike usage. Fair enough but unless there is some hidden trickery it will only save the time in the to do: and basicAt: which isn't a lot. Hmm, I suppose one could use the prim to set some lock on the collection while one is iterating. Problematic if the block code modifies the collection.
tim -- Tim Rowledge, tim@sumeru.stanford.edu, http://sumeru.stanford.edu/tim Strange OpCodes: FSM: Fold, Spindle and Mutilate