From: mortee Date: 2007-10-26T10:55:07+09:00 Subject: Re: Intervals in Ruby ara.t.howard wrote: > > On Oct 25, 2007, at 3:58 PM, mortee wrote: >> Hmmm, are you sure that zip duplicates all the involved arrays even if >> passed a block? > > pretty sure: > > cfp:~ > ruby -e' p ObjectSpace.each_object(Array){}; p [4].zip([2]){ > break ObjectSpace.each_object(Array){} } ' > 6 > 9 > > 6 to start, create 2, zip makes one more = 9 It's sure to create arrays. Those ones that hold the corresponding values from the original arrays, and only for the duration of the current iteration. But if you zip two 100-element arrays, it won't duplicate either simultaneously, it'll just create two-element arrays to be passed to the block temporarily. Is that so bad? mortee