2008/3/2, ts <decoux / moulon.inra.fr>: > How do you do this ? > > vgs% cat cur.rb > class A > define_method(:a) do |x, y| > puts "a #{x} -- #{y}" > end > end > > class B > def a(x) > puts "b #{x}" > end > end > > a = :a.to_proc.curry > b = a[A.new] > c = b[12] > c[12] > > b = a[B.new] > b[12] > > vgs% > > > vgs% ./ruby cur.rb > a 12 -- 12 > b 12 > vgs% Aha, I didn't know what Symbol#to_proc is. It is indeed a feature that :foo.to_proc.arity is -1. Well, though it is slightly confusing to change the number of arguments dynamically - depending on the first argument, and - only when the proc is made from Symbol#to_proc, it may be also essential. I wonder if I should change Proc#curry. By the way, I'm curious to know what purpose do people use Proc#curry for. I suggested it to define SKI combinator more simply, but I don't feel so many people play with SKI combinator ;) s = proc {|f, g, x| f[x][g[x]] }.curry k = proc {|x, y| x }.curry -- Yusuke ENDOH <mame / tsg.ne.jp>