Function: apply-partially

apply-partially is a byte-compiled function defined in subr.el.gz.

Signature

(apply-partially FUN &rest ARGS)

Documentation

Return a function that is a partial application of FUN to ARGS.

ARGS is a list of the first N arguments to pass to FUN. The result is a new function which does the same as FUN, except that the first N arguments are fixed at the values with which this function was called.

In almost all cases, you want to use a regular anonymous function defined with lambda instead. It will be faster, because it does not have the overhead of calling apply and append, which this function has to do internally.

View in manual

Probably introduced at or before Emacs version 23.1.

Aliases

-partial

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun apply-partially (fun &rest args)
  "Return a function that is a partial application of FUN to ARGS.
ARGS is a list of the first N arguments to pass to FUN.
The result is a new function which does the same as FUN, except that
the first N arguments are fixed at the values with which this function
was called.

In almost all cases, you want to use a regular anonymous function
defined with `lambda' instead.  It will be faster, because it does not
have the overhead of calling `apply' and `append', which this function
has to do internally."
  (declare (side-effect-free error-free))
  (lambda (&rest args2)
    (apply fun (append args args2))))