News for hackers. Stuff that matters.
Re:Object#returning (Ruby's K Combinator) by raganwald on Thursday August 28, 2008 @10:46AM (#289162)
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

There are no comments on this comment yet.