XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

boundp


Type:   -   predicate function (subr)
Source:   -   xlbfun.c

Syntax

(boundp symbol)
symbol - the symbol expression to check for a value
returns -  T  if a value is bound to the symbol, NIL otherwise

Description

The 'boundp' predicate function checks to see if 'symbol' is a symbol with a value bound to it.  T  is returned if 'symbol' has a value, NIL is returned otherwise. Note that 'symbol' is a symbol expression. It is evaluated and the resulting expression is the one that is checked.

Examples

(setq a 1)                 ; set up A with value 1
(boundp 'a)                ; returns T - value is 1
(defun foo (x) (print x))  ; set up function FOO
(boundp 'foo)              ; returns NIL - value is closure
(boundp 'defvar)           ; returns NIL - value is closure
(boundp 'car)              ; returns NIL - value is closure
(print myvar)              ; error: unbound variable
(BOUNDP 'myvar)            ; returns NIL
(setq myvar 'abc)          ; set up MYVAR with a value
(BOUNDP 'myvar)            ; returns T - because of SETQ
(setq myvar 'qq)           ; set up MYVAR to have value QQ
(BOUNDP myvar)             ; returns NIL - because QQ has
                           ;               no value yet
(setq qq 'new-value)       ; set QQ to have value NEW-VALUE
(BOUNDP myvar)             ; returns T

See the boundp predicate function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next