From: Robert Dober Date: 2011-03-23T00:31:26+09:00 Subject: Re: summing values in a hash? On Tue, Mar 22, 2011 at 4:08 PM, Robert Klemme wrote: jruby -e 'p( {:a=>42}.inject(0){|a,b|a+b})' TypeError: Array can't be coerced into Fixnum + at org/jruby/RubyFixnum.java:333 __file__ at -e:1 each at org/jruby/RubyHash.java:1167 inject at org/jruby/RubyEnumerable.java:816 (root) at -e:1 I recon you where coming from Hash#values, however on applying the code to an empy hash, where it works of course the reader could be missled Cheers Robert -- The 1,000,000th fibonacci number contains '42' 2039 times; that is almost 30 occurrences more than expected (208988 digits). N.B. The 42nd fibonacci number does not contain '1000000' that is almost the expected 3.0e-06 times.