From: Simon Strandgaard Date: 2004-04-12T21:44:14+09:00 Subject: Re: proposal - zip to do padding On Mon, 12 Apr 2004 07:40:29 +0100, daz wrote: > Simon Strandgaard wrote: >> >> It would be awesome if #zip could do the same >> with non-nil elements.. (this is what I propose) >> >> p (4..6).zip('a', 'b') >> #=> [[4, "a", "b"], [5, "a", "b"], [6, "a", "b"]] >> > > p (4..6).map {|n| [n, 'a', 'b']} > > #=> [[4, "a", "b"], [5, "a", "b"], [6, "a", "b"]] > Yes padding can be accomplished with map (requires sligthly more typing). The reason I propose it, is that I think this a more useful behavier of zip, rather than the current behavier where it only pads the first element. I have interest in #zip's behavier, if there is oddities then I ask why.. With 1.9 #zip has been extended, this proposal is about fixing the behavier of that extension. -- Simon Strandgaard