> > Nice, but very, very slow... > > better? It's getting better, yes... ;] Have you tried to build big triangles? Caching is MB-expensive and still not really fast... ;] gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- $ time ruby yourversion.rb 666 > /dev/null [["troep2.rb:16:in `c_lambda'", "troep2.rb:24"], 1] [["troep2.rb:16:in `c_lambda'", "troep2.rb:23"], 1] [["troep2.rb:16:in `c_lambda'", "troep2.rb:22"], 666] [["troep2.rb:16:in `c_lambda'", "troep2.rb:21"], 1] [["troep2.rb:16:in `c_lambda'", "troep2.rb:20"], 222111] [["troep2.rb:16:in `c_lambda'", "troep2.rb:19"], 666] real 1m29.039s user 1m20.466s sys 0m0.571s $ time ruby myversion.rb 666 > /dev/null real 0m10.232s user 0m9.613s sys 0m0.030s ---------------------------------------------------------------- clas CachedLambda < Struct.new(:block, :cache) def initialize(*args) super @caller = caller at_exit do $stderr.puts [@caller, cache.size].inspect end end def [] *args cache[args] ||= block.call(*args) end end ----------------------------------------------------------------