Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: