我想将生成的(高阶函数)传递给 ruby 方法的方法。像这样的东西
[].select give_block
def give_block
lambda { |e| e > 1 }
end
我收到一条错误消息
"wrong number of arguments (1 for 0)"
我怎么能完成这样的事情?
我想将生成的(高阶函数)传递给 ruby 方法的方法。像这样的东西
[].select give_block
def give_block
lambda { |e| e > 1 }
end
我收到一条错误消息
"wrong number of arguments (1 for 0)"
我怎么能完成这样的事情?