On Dec 2, 2007, at 18:12 , Voroztsov Artem wrote: > class Array > def flatten2 > res = [] > x = self.reverse > while !x.empty? > a = x.pop > if a.is_a?(Array) > x.push(*a) > else > res << a > end > end > res.reverse > end > end With that not being recursive, how do you deal with sub-sub-arrays? Hrm... it seems to work. A feature in splat? I'll have to look into that. But: >> [:a, [:b, [:c], :d], :e].flatten2 => [:e, :b, :c, :d, :a]