Hi, On 5/24/06, Pit Capitain <pit / capitain.de> wrote: > Christian Neukirchen schrieb: > > > > longest = data.inject{|max, this| [this.length, max.length].max } > > > > ;-) (That's how they do it in APL too, btw.) > > I know why I prefer Ruby ;-) > > data = %w"hello christian and APL" > p data.inject{|max, this| [this.length, max.length].max } > > # => undefined method `length' for 9:Fixnum (NoMethodError) > This works: p data.inject(0){|max, this| [this.length, max].max } And in APL it's 4 Unicode characters plus the symbol: (max)(reduce)(shape)(each)data, where (reduce) is an operator on (max) producing the function which is equivalent to Ruby's inject method. So there ... :-) Stuart > Regards, > Pit > >