4 ms·
To be honest, I'm not really sure. I think it's a superficial difference. When I put this into a Ruby 1.9.2 REPL def foo (n) lambda {|i| n += i } e
by spacemanaki 15y ago
To be honest, I'm not really sure. I think it's a superficial difference. When I put this into a Ruby 1.9.2 REPL
def foo (n)
lambda {|i| n += i } end
I expected to be able to do this:
acc = foo(0)
acc(1)
But instead have to do
acc.call(1)
Maybe there's another way...
Edit: oops you pointed out this example in another comment, sorry! Is there no way for the returned lambda to "feel" like a regular function?
- deleted 15y ago[deleted]