type: defined macro (closure) location: extension source file: init.lsp Common LISP compatible: similar supported on: all machines
(defvar <symbol> [ <init-value> ] ) <symbol> - an expression evaluating to a symbol <init-value> - an optional initial value expression
The DEFVAR macro defines a user variable with the name <symbol>. If <symbol> did not already exist, the <symbol> is created with the initial value NIL. If the optional <init-value> expression is present, the new <symbol> will be set to the <init-value>. If <symbol> did exist, its previous value will be left untouched. DEFVAR returns the <symbol> as its result.
(boundp 'mvyar) ; returns NIL - doesn't exist (defvar myvar) ; returns MYVAR (boundp 'myvar) ; returns T (setq myvar 7) ; returns 7 (defvar myvar) ; returns MYVAR myvar ; returns 7 - was not initialized (defvar myvar 99) ; returns MYVAR myvar ; returns 7 - was not initialized
BUG: In Common LISP, the definition of DEFVAR is such that it returns the <symbol> as its result. XLISP returns the value of <symbol>.
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.