(rontolisp) docs
← cl Package Functions

fdefinition

(fdefinition function-name)

The function value of a function name: a symbol, like symbol-function, or a (setf name) list naming the function (defun (setf name) ...) defines. An undefined name signals undefined-function, whose cell-error-name is the name, list included.

A quoted symbol literal ((fdefinition 'car)) resolves at compile time in the compilers; a runtime-computed symbol resolves late through the compiled name registry and answers the same function value -- like symbol-function, with no deviations. A quoted (setf name) list is #'(setf name) on every backend. A list built at run time is taken too; on the compiled backends its function resolves where the program spells its place symbol, as a computed symbol resolves where the program spells it.

fdefinition is the same setf place as symbol-function: (setf (fdefinition 'name) fn) installs fn as the symbol's global function definition, and (setf (fdefinition '(setf name)) fn) installs the (setf name) function. After a write of a quoted name, every reference to the name sees fn, in code compiled before the write too, on every backend. The name may also be built at run time ((list 'setf p), (intern s)): a direct call, a setf place, #'name and fboundp of a name only such a write (or eval's defun) binds look it up when they run, on every backend. A name a defun also defines, written through a name built at run time, by eval or by load, answers the new definition for every reference too, until the next defun form of the name runs. In a program that evaluates no data the name has to be one a value of the program spells -- a quoted symbol, or beside intern a string: a name assembled out of computed strings reaches only a call through a name computed at run time.