« Back to Index

Why does this fail in MRI 2.0 but pass in JRuby (which is API compat with MRI 1.9.3)?

View original Gist on GitHub

Curry.rb

my_proc = proc { |x, y, z| x + y + z }
add_to_the_value_three = my_proc.curry(2)[1][2]
puts add_to_the_value_three[6] # => 9

=begin
test.rb:1:in `+': nil can't be coerced into Fixnum (TypeError)
	from test.rb:1:in `block in <main>'
	from test.rb:2:in `[]'
	from test.rb:2:in `<main>'
=end