From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/primitive-function-type.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 devdocs/elisp/primitive-function-type.html (limited to 'devdocs/elisp/primitive-function-type.html') diff --git a/devdocs/elisp/primitive-function-type.html b/devdocs/elisp/primitive-function-type.html new file mode 100644 index 00000000..4e93aeea --- /dev/null +++ b/devdocs/elisp/primitive-function-type.html @@ -0,0 +1,12 @@ +

Primitive Function Type

A primitive function is a function callable from Lisp but written in the C programming language. Primitive functions are also called subrs or built-in functions. (The word “subr” is derived from “subroutine”.) Most primitive functions evaluate all their arguments when they are called. A primitive function that does not evaluate all its arguments is called a special form (see Special Forms).

It does not matter to the caller of a function whether the function is primitive. However, this does matter if you try to redefine a primitive with a function written in Lisp. The reason is that the primitive function may be called directly from C code. Calls to the redefined function from Lisp will use the new definition, but calls from C code may still use the built-in definition. Therefore, we discourage redefinition of primitive functions.

The term function refers to all Emacs functions, whether written in Lisp or C. See Function Type, for information about the functions written in Lisp.

Primitive functions have no read syntax and print in hash notation with the name of the subroutine.

(symbol-function 'car)          ; Access the function cell
+                                ;   of the symbol.
+     ⇒ #<subr car>
+(subrp (symbol-function 'car))  ; Is this a primitive function?
+     ⇒ t                       ; Yes.
+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Primitive-Function-Type.html +

+
-- cgit v1.2.3