From: "duerst (Martin Dürst)" <duerst@...>
Date: 2012-05-28T12:47:22+09:00
Subject: [ruby-core:45289] [ruby-trunk - Feature #6499] Array::zip


Issue #6499 has been updated by duerst (Martin D��rst).


The problem becomes even more obvious in the cases where one starts with an array of arrays:
New way:
   Array.zip(*arrays)
Old way:
   arrays[0].zip(*arrrays[1..-1])
The new way is clear and concise. The old way is a mess. I have definitely met this pattern for zip and product, maybe others. I always wished there had been a better way, but the idea I came up with was something like arrays.zips_many or so. That might work, too, but Array.zip is quite neat, too.
----------------------------------------
Feature #6499: Array::zip
https://bugs.ruby-lang.org/issues/6499#change-26870

Author: prijutme4ty (Ilya Vorontsov)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: 
Target version: 


Sometimes it's more natural to have Array::zip rather than Array#zip. Otherwise first array of list became unnecessary dedicated
For example 
cols = first_row.zip(second_row,third_row,fourth_row)
have more natural analog:
cols = Array.zip(first_row,second_row,third_row,fourth_row)

Implementation is obvious:
def Array.zip(first,*rest)
  first.zip(*rest)
end


-- 
http://bugs.ruby-lang.org/