def foo (n) lambda {|i| n += i } end
acc = foo(0) acc(1)
acc.call(1)
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?
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?