Re:Small functions to functionally augment ruby.
by irahul on Friday September 09, 2011 @10:31AM
(#2978224)
Welcome to Ruby - Ruby has procs, blocks, lambdas, methods which are similar yet different.
Blocks aren't objects - when they are converted to objects, they become procs. Procs are like blocks and lambdas are like methods, but you can't call either of them with () syntax.
And then there are multiple ways to call them:
f.call()
f[]
f.()
Take your pick.
Re:Small functions to functionally augment ruby.
by happy4crazy on Friday September 09, 2011 @09:49AM
(#2978064)
No. The (sqr * inc) part returns a lambda, and in order to call a lambda you need to either .call() it, or you can use the [] syntax.
(sqr * inc)(5) ?