(lispref.info)Primitive Function Type


Next: Byte-Code Type Prev: Lisp Macro Type Up: Programming Types

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" (Note: Special Forms.).

   It does not matter to the caller of a function whether the function
is primitive.  However, this does matter if you are trying to
substitute a function written in Lisp for a primitive of the same name.
The reason is that the primitive function may be called directly from
C code.  When the redefined function is called from Lisp, the new
definition will be used; but calls from C code may still use the old
definition.

   The term "function" is used to refer to all Emacs functions, whether
written in Lisp or C.  Note: Lisp 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.


automatically generated by info2www