From: Florian Frank Date: 2007-11-29T05:00:28+09:00 Subject: Re: Ruby needs continuations... ara.t.howard wrote: >> a.zip(b, c, d, ...) > > when a, b, c, and d are large it's most undesirable to use zip, > forcing one to use > > lists = a,b,c,d > n = lists.map{|list| list.size}.max > > (0 ... n).each do |i| > ai, bi, ci, di = lists.map{|list| list[i]} > # ... > end zip doesn't force you to do this, you can also pass a block to zip. In Ruby 1.9. zip without a block won't create and return an array anymore, but it will return an Enumerator object as a promise instead. > and, when b, c, and d are heterogeneous containers the above code is > most often impossible - you will first need to convert all the > containers to lists and then iterate. If you want zip to act smarter on it's arguments you will have to use Ruby 1.9. -- Florian Frank