From: Sheldon Hearn Date: 2012-08-14T03:13:52+09:00 Subject: [ruby-core:47157] Re: [ruby-trunk - Feature #6852] [].transpose should behave specially On Mon, Aug 13, 2012 at 3:15 PM, marcandre (Marc-Andre Lafortune) wrote: >> It would be interesting to see code that found returning [] to be >> useful. As in, code that expected to operate on the transposed result. > > I can imagine code that wants to iterate on all elements, but going through columns first. E.g: > [...] > # Using transpose (or zip) is nicer: > [exams, grades].transpose.each do |exam, grade| > # do the same with exam and grade > end So there are at least some situations when [] would be a useful result. And while there are situations where no result would be useful, it doesn't much matter in those situations whether you get an exception or a result that isn't useful. I'm convinced. :-) Ciao, Sheldon.