Rewriting the inject method in Ruby, with Ruby.