53 ms·
True, and worth noting. Also of interest: Ruby 1.9 includes a different implementation of the K Combinator, Object#tap. It's a method rather than a pseudo-funct
by raganwald 18y ago
True, and worth noting. Also of interest: Ruby 1.9 includes a different implementation of the K Combinator, Object#tap. It's a method rather than a pseudo-function, so instead of:
returning (Fubar.new) do |f|
...
end
Your write:
Fubar.new.tap do |f|
...
end
Shameless plug-whoring: The andand gem includes an enhanced Object#tap: http://andand.rubyforge.org http://andand.rubyforge.org