From: "John W. Long" Date: 2005-02-11T13:29:39+09:00 Subject: Re: Building a Better Functor Trans wrote: > Hi-- > > Just FYI. I do not think this is what one calls a Functor exactly, > since the object is independent of the method ( please see > http://jakarta.apache.org/commons/sandbox/functor/ ). > > . . . > > f = Functor.new { |op, x| x.send(op, x) } > f + 1 #=> 2 > f + 2 #=> 4 > f + 3 #=> 6 > f * 1 #=> 1 > f * 2 #=> 2 > f * 3 #=> 9 > > . . . Interesting. So how exactly would you define a functor? What you have shown above seems to be an object that knows how to do some kind of operation using a user-defined method. Is this how you would define a functor? -- John Long http://wiseheartdesign.com