title: Ruby rcurry. How I can implement proc "right" currying?
body: <p>I'm working in a new gem to extend the Ruby Core classes, something similar to <a href="http://edgeguides.rubyonrails.org/active_support_core_extensions.html" rel="nofollow">Active Support Core Extensions</a> or <a href="https://github.com/bbatsov/powerpack" rel="nofollow">Powerpack</a>. These days I'm working on the <code>Proc</code> class, for example I added <a href="http://arturoherrero.com/closure-design-patterns-ruby-edition/#closure-composition" rel="nofollow">closure composition</a>.</p>
  
  <p>But today I like to talk about currying. This is the Ruby standard library functionality for <code>curry</code>:</p>
  
  <pre><code>describe "#curry" do
    it "returns a curried proc" do
      modulus = -&gt;(mod, num) { num % mod }
      mod2 = modulus.curry[2]
      expect(mod2.call(5)).to eq(1)
    end
  end
  </code></pre>
  
  <p>I like to add a new <code>rcurry</code> method to support proc "right" currying to pass the following spec. It's the same issue reported a few months ago, <a href="https://bugs.ruby-lang.org/issues/11161" rel="nofollow">Proc/Method#rcurry working like curry but in reverse order</a>.</p>
  
  <pre><code>describe "#rcurry" do
    it "returns a right curried proc" do
      modulus = -&gt;(mod, num) { num % mod }
      mod2 = modulus.rcurry[2]
      expect(mod2.call(5)).to eq(2)
    end
  end
  </code></pre>