M
Matthew Moss
(On Mac OS X 10.4.5, Ruby 1.8.4)
Okay, so:
and:
but:
What gives?
I've tried replacing {} with Hash.new and a couple other variants without l=
uck.
Okay, so:
=3D> 6[1, 2, 3].inject(0) { |s, v| s +=3D v }
and:
=3D> [1, 4, 9][1, 2, 3].inject([]) { |a, v| a << v**2 }
but:
=3D> NoMethodError: undefined method `[]=3D' for 1:Fixnum[1, 2, 3].inject({}) { |h, v| h[v] =3D v**2 }
What gives?
I've tried replacing {} with Hash.new and a couple other variants without l=
uck.