RosettaCodeData/Task/Higher-order-functions/Ruby/higher-order-functions-2.rb

10 lines
82 B
Ruby
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
def succ(n)
n+1
end
def to2(m)
m[2]
end
meth = method(:succ)
to2(meth) #=> 3