4 ms·
That's pretty much it; the only other way is to build a function combinator from a Proc or Lambda: irb(main):004:0> multiply = -> a, b { a * b } => #<Proc:0x00
by donw 14y ago
That's pretty much it; the only other way is to build a function combinator from a Proc or Lambda:
irb(main):004:0> multiply = -> a, b { a * b }
=> #<Proc:0x007fe2822029e0@(irb):4 (lambda)>
irb(main):006:0> square = -> a { multiply.call(a, a) }
=> #<Proc:0x007fe2840746a8@(irb):6 (lambda)>
irb(main):007:0> square.call(3)
=> 9