title: Generalised Curry - Javascript
body: <p>While reading an <a href="https://hackernoon.com/currying-in-js-d9ddc64f162e" rel="nofollow noreferrer">article</a> on implementation of a generalised curry in Javascript, I stumbled upon this piece of code. </p>
  
  <pre><code>function curry(fn) {
    return (...xs) =&gt; {
      if (xs.length === 0) {
        throw Error('EMPTY INVOCATION');
      }
      if (xs.length &gt;= fn.length) {
        return fn(...xs);
      }
      return curry(fn.bind(null, ...xs));
    };
  }
  </code></pre>
  
  <p>I am unable to grok the part of the explanation which states </p>
  
  <blockquote>
    <p>We create a copy of fn that has the first k arguments bound 
    (partially applied) and pass it to curry as the next fn, with its reduced arity of N - k.</p>
  </blockquote>
  
  <p>How does the arity of <code>fn</code> reduced to N-k in the subsequent calls? A bound function with k arguments should have an arity of k right? </p>