KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to do some currying in ruby: def add(a,b) return a+b end plus = lambda {add} curry_plus = plus.curry plus_two = curry_plus[2] #Line 24 puts plus_two[3] I get the error func_test.rb:24:in `[]': wrong number of arguments (1 for 0) (ArgumentError) from func_test.rb:24:in `' But if I do plus = lambda {|a,b| a+ b} It seems to work. But by printing plus after the assigning with lambda both ways return the same type of object. What have I misunderstood?
Tags (comma-separated)
Save Edits
Cancel