In a general sense, a function is a rule for carrying on a computation given several values called arguments. The result of the computation is called the value of the function. The computation can also have side effects: lasting changes in the values of variables or the contents of data structures.
Here are important terms for functions in Emacs Lisp and for other function-like objects.
car or append. These functions are also called
built-in functions, or subrs. (Special forms are also
considered primitives.)
Usually the reason we implement a function as a primitive is either
because it is fundamental, because it provides a low-level interface
to operating system services, or because it needs to run fast.
Primitives can be modified or added only by changing the C sources and
recompiling the editor. See Writing Emacs Primitives.
command-execute can invoke; it
is a possible definition for a key sequence. Some functions are
commands; a function written in Lisp is a command if it contains an
interactive declaration (see Defining Commands). Such a function
can be called from Lisp expressions like other functions; in this case,
the fact that the function is a command makes no difference.
Keyboard macros (strings and vectors) are commands also, even though
they are not functions. A symbol is a command if its function
definition is a command; such symbols can be invoked with M-x.
The symbol is a function as well if the definition is a function.
See Interactive Call.
This function returns
tif object is any kind of function, i.e. can be passed tofuncall. Note thatfunctionpreturnsnilfor special forms (see Special Forms).
Unlike functionp, the next three functions do not
treat a symbol as its function definition.
This function returns
tif object is a built-in function (i.e., a Lisp primitive).(subrp 'message) ;messageis a symbol, ⇒ nil ; not a subr object. (subrp (symbol-function 'message)) ⇒ t
This function returns
tif object is a byte-code function. For example:(byte-code-function-p (symbol-function 'next-line)) ⇒ t
This function provides information about the argument list of a primitive, subr. The returned value is a pair
(min.max). min is the minimum number of args. max is the maximum number or the symbolmany, for a function with&restarguments, or the symbolunevalledif subr is a special form.