Comment on Lisp: More is lessparentComments−jeorgun12yYou can pass Ruby methods around; the syntax is just ugly, and it isn't really used: def call_on_two fn fn.call 2 end call_on_two 1.method(:+) #=> 3 The problem with [1, 2, 3].map(:function_name) is just that map requires a block, and not a method or proc.A method like that could be easily enough created, though it'd be kind of ugly: module Enumerable def map_fn fn map { |i| method(fn).call i } end end def foo num num + 2 end [1, 2, 3].map_fn :foo #=> [3, 4, 5] I don't know why there isn't an easy way to freely convert between methods, procs, and blocks; it's definitely something the language is missing.
Comments
You can pass Ruby methods around; the syntax is just ugly, and it isn't really used:
The problem with [1, 2, 3].map(:function_name) is just that map requires a block, and not a method or proc.A method like that could be easily enough created, though it'd be kind of ugly:
I don't know why there isn't an easy way to freely convert between methods, procs, and blocks; it's definitely something the language is missing.