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.

defconstant

defconstant

type: defined macro (closure)
location: extension
source file: init.lsp
Common LISP compatible: similar
supported on: all machines

SYNTAX

(defconstant  <symbol>  <init-value> )
        <symbol>        -       an expression evaluating to a symbol
        <init-value>    -       an initial value expression 

DESCRIPTION

The DEFCONSTANT macro defines a user constant with the name <symbol>. The <symbol> is created with the initial value <init-value> expression. If <symbol> did exist, its previous value will be overwritten. DEFCONSTANT returns the <symbol> as its result.

EXAMPLES

(boundp 'mvyar)                         ; returns NIL - doesn't exist
(defconstant myvar 7)                   ; returns MYVAR
(boundp 'myvar)                         ; returns T
myvar                                   ; returns 7

BUG: In Common LISP, the definition of DEFCONSTANT is such that it returns the <symbol> as its result. XLISP returns the value of <symbol>.

COMMON LISP COMPATIBILITY: In Common LISP, any change to the value of the DEFCONSTANT <symbol> is supposed to generate an error. XLISP treats it like any user symbol and allows it to change.

COMMON LISP COMPATIBILITY: Common LISP supports an additional optional parameter. This parameter is a documentation string. XLISP does not support this.

NOTE: The functions DEFVAR, DEFPARAMETER and DEFCONSTANT are created in the INIT.LSP file. If it does not exist in your XLISP system, you might be having a problem with INIT.LSP. Before you start XLISP, look in the directory you are currently in, and check to see if there is an INIT.LSP.


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