javascript curry/partial function invokation for object functions
<p>I want a 'curry' like function - this kind of thing</p>

<pre><code>function invoker (fn) {
    var slice = Array.prototype.slice,
        args = slice.apply(arguments, [1]);
    return function () {
       return fn.apply(null, args);
    };
}
</code></pre>

<p>But I want the user to be able to do</p>

<pre><code>invoker(f)
</code></pre>

<p>or </p>

<pre><code>invoker(foo.bar)
</code></pre>

<p>I cant find the correct magic incantation to do this. All the examples I see require the scope object to be passed in separately; which is error prone and not natural. IE</p>

<pre><code>invokerx(foo.bar, foo)
</code></pre>

<p>IS there anyway to do this? I dont mind having 2 different functions</p>

<pre><code>invokeG(f)
invokeO(foo.bar)
</code></pre>

<p>EDIT : clarification</p>

<pre><code>'f' is a global scope function
'foo' is an object
'bar is a method on that object
</code></pre>

<p>IE I want this curry tool to work with'free' functions as well as with object functions.</p>

<p>Having to go</p>

<pre><code>&lt;curry function&gt;(foo.bar,foo)
</code></pre>

<p>seems kinda clunky, I have have to say 'foo' twice</p>
