GNU Info

Info Node: (librep.info)Functions

(librep.info)Functions


Next: Macros Prev: Variables Up: The language
Enter node , (file) or (file)node

Functions
=========

   A "function" is a Lisp object which, when applied to a sequence of
argument values, produces another value--the function's "result". It
may also induce side-effects (e.g. changing the environment of the
calling function). All Lisp functions return results -- there is
nothing like a procedure in Pascal.

   Note that special forms (Note: Special Forms) and macros (Note:
Macros) are _not_ functions since they do not guarantee to evaluate
all of their arguments.

   Functions are the main building-block in Lisp programs, each program
is usually a system of interrelated functions.

   There are two types of function: "primitive functions" are functions
written in the C language, these are sometimes called built-in
functions, the object containing the C code itself is called a "subr".
All other functions are defined in Lisp.

 - Function: functionp object
     Returns true if OBJECT is a function (i.e. it can be used as the
     function argument of `funcall'.

          (functionp set)
              => t
          
          (functionp setq)
              => ()
          
          (functionp (lambda (x) (+ x 2)))
             => t

 - Function: subrp arg
     Returns true is ARG is a primitive subroutine object.

 - Function: subr-name subr
     Returns a string naming the primitive subroutine SUBR.

Lambda Expressions
Structure of a function object
Defining Functions
How to write a function definition
Anonymous Functions
Or they can be un-named
Predicate Functions
Functions which return boolean values
Local Functions
Binding functions temporarily
Calling Functions
Functions can be called by hand
Mapping Functions
Map a function to the elements of a list

automatically generated by info2www version 1.2.2.9