From: Mark Hubbart Date: 2005-04-15T06:05:27+09:00 Subject: Re: Weaving Arrays On 4/14/05, Martin DeMello wrote: > Mark Hubbart wrote: > > If the result you want is: > > (1..4).weave('a'..'d') #==>[1, "a", 2, "b", 3, "c", 4, "d"] > > But what about (1..10).weave('a'..'d')? Empty spaces get filled with nils; elements beyond the number in the receiver on enumerables passed as arguments will be ignored. (1..10).weave('a'..'d') #==>[1, "a", 2, "b", 3, "c", 4, "d", 5, nil, 6, nil, 7, nil, 8, nil, 9, nil, 10, nil] ('a'..'d').weave(1..10) #==>["a", 1, "b", 2, "c", 3, "d", 4] I glanced at the OP's code again, and I'm pretty sure that works the same way, but in a faster and more generalized fashion. cheers, Mark