title: Unpack vector into function arguments
body: <p>I have a function with four parameters, e.g.</p>
  
  <pre><code>fun &lt;- function( x, a, b, c ) {
      sin( x * a ) * exp( -x * b ) + x * c
  }
  </code></pre>
  
  <p>I'd like to convert that into a function with three arguments provided as a vector, fixing the first (to some <code>df$X</code> in this example). The following obviously works:</p>
  
  <pre><code>fx &lt;- function( args ) {
      fun( df$X, args[ 1 ], args[ 2 ], args[ 3 ] )
  }
  </code></pre>
  
  <p>How do I wrap this process into a function <em>for any number of trailing function parameters</em>, returning the function <code>fx</code> above? Pseudocode:</p>
  
  <pre><code>fixVector &lt;- function( f, vec ) {
      function( args ) {
          f( vec, magic_unpack( args ) )
      }
  }
  fx &lt;- fixVector( fun, df$X )
  
  fx &lt;- fixVector( fun, 1:10 )
  fx( 1:3 )
  # [1]  3.113881  6.016654  9.000350 11.999746 14.999956 17.999998 21.000001 24.000000 27.000000 30.000000
  </code></pre>
  
  <p>What's a suitable definition for <code>magic_unpack()</code>?</p>