On Wed, 2004-01-14 at 16:33, Johan Holmberg wrote: > The best way I have found until now, of doing what I want is > > arr2 = arr1.inject([]) {|acc,x| acc.concat x} You can also use "+" here: arr2 = arr1.inject([]) { |a,x| a + x } > But I feel that the thing I want to do (concatenating a variable > number arrays) is such a natural thing, that it deserves a cleaner > way of being expressed. If you extend Symbol like this: class Symbol def to_proc lambda { |a, b| a.__send__(self, b) } end end You could also write arr2 = arr1.inject([], &:+) That's pretty similar to how it is done in most functional programming languages. -- o=lambda{|o|p o};O=Struct.new(:a,:b,:c);e=%q(_(?h,_(?h,_(?\ ,_(?s,_(?u,_(74)), _(?t)),_(?t,_(?o,_(?n,_(?a))))),_(82,_(?r,_(?e),_(32)),_(32,_(98,_(?u),_(?y))) )),_(?r,_(99,_(97),_(?k,nil,_(?e))),_(10))));def _(*a)O.new(*a)end;class O;def e(&o)b&&b.e(&o);o[a];c&&c.e(&o)end;end;def p(o)print(''<<o)end;eval(e).e(&o)