From: "Stephan Kämper" Date: 2001-10-11T06:58:40+09:00 Subject: [ruby-talk:22402] Is there something like a functor in Ruby Hi all, I'm writing some numerical routines like the bisection method to find a root for a function ( x: R -> R, at the moment - higher dimensions will probably follow later on)... Now for testing purposes I'd like to produce an array of blocks, Procs or whatever and iterate over that array. Then it woulb be easy to apply the method under test to a couple of 'test functions'. Basically I'd like to do something like this: Say MyClass.initialize is something like this: def MyClass def initialize ( a, b, &c ) @a, @b, @c = a, b, c end end functions = # ... an array of 'things' m = MyClass.new( someParameter, someOther ) functions.each { | funct | m = MyClass.setFunction funct # invoce some methods of m (that use funct via the member @c) } Is there a way to do this? Any help appreciated. Happy minig, Stephan