From: timsuth@... (Tim Sutherland) Date: 2002-11-15T11:42:04+09:00 Subject: Re: ruby-dev summary 18613-18710 In article <20021112020739J.maki@rubycolor.org>, TAKAHASHI Masayoshi wrote: [...] > There is a discussion whether Enumerable#zip is appropriate or not. > > ex. > * Enumerable.zip(a, b, c...) > * Array.zip(a, b, c...) > * [a, b, c..].zip How about the latter, with an optional block. a = [1, 0, 3] b = [2, 1, 2] c = [3, 2, 1] [a, b, c].zip { |x, y, z| x*y + z } #=> [5, 2, 7] Now zip is like lisp's map. One possibility for when the arrays are different lengths: 1) No block is given: exception. 2) A block is given: some block arguments will be nil in the usual way, up to the user to deal with it. [...]