Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

function

function

type: special form (fsubr)
location: built-in
source file: xlcont.c 
Common LISP compatible: yes
supported on: all machines

SYNTAX

(function <expr> )
        <expr>          -       an expression that evaluates to a function

DESCRIPTION

FUNCTION returns the function definition of the <expr>. Execution of the <expr> form does not occur. FUNCTION will operate on functions, special forms, lambda-expressions and macros.

EXAMPLES

(function car)                          ; returns #<Subr-CAR: #23ac4>
(function quote)                        ; returns #<FSubr-QUOTE: #23d1c>
#'quote                                 ; returns #<FSubr-QUOTE: #23d1c>
(function 'cdr)                         ; error: not a function 
(defun foo (x) (+ x x))                 ; define FOO function
(function foo)                          ; returns #<Closure-FOO: #2cfb6>
(defmacro bar (x) (+ x x))              ; define FOOMAC macro
(function bar)                          ; returns #<Closure-BAR: #2ceee>
(setq my 99)                            ; define a variable
(function my)                           ; error: unbound function
(defun my (x) (print x))                ; define a function
(function my)                           ; returns #<Closure-MY: #2cdd6>
                                        ;
                                        ; NOTE THAT THERE ARE 2 SYMBOLS
                                        ; A VARIABLE my AND A FUNCTION
                                        ; my.

READ MACRO: XLISP supports the normal read macro of a hash and quote (#') as a short-hand method of writing the FUNCTION special form.


Go to the first, previous, next, last section, table of contents.