Pattern matching and tail recursion in Emacs Lisp
That ela&#x2F;apply function is actually reduce.<p>You cannot call the function multiple calls with funcall to implement apply; there has to be only one call to funcall.<p>Basically you have to ways:<p>Switch on different argument list lengths, to one of many funcall expressions that has a matching arity:<p><pre><code>  (pcase args
    (() (funcall fn))
    (`(,a1) (funcall fn a1))
    (`(,a1 ,a2) (funcall fn a1 a2))
    (`(,a1 ,a2 ,a3) (funcall fn a1 a2 a3))
    ...))
</code></pre>
Or build the funcall dynamically and eval it:<p><pre><code>  (eval `(funcall ,fn ,@args))
</code></pre>
Lisp newbiews who don&#x27;t know about apply sometimes end up simulating it like this.