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


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


(symbol-value symbol)
symbol - an expression that evaluates to a symbol name
returns - the symbol's value


The 'symbol-value' function takes the 'symbol' expression and returns the current value of the 'symbol'.

If the 'symbol' had not existed, then it will be created and interned into the system symbol table *obarray* , but with it's value unbound and an empty property list. In this case of a previously non-existant 'symbol', since it has no bound value, the 'symbol-value' function will still report an error due to an unbound variable.


(setq myvar 55)                   ; set MYVAR to value 55
(symbol-value 'myvar)             ; returns 55
(symbol-value 'floop)             ; error: unbound variable

(setq my-symbol 'a)               ; set MY-SYMBOL to A

(setq a '(contents of symbol a))  ; set A to value (CONTENTS OF SYMBOL A)

(symbol-value my-symbol)          ; returns (CONTENTS OF SYMBOL A)

See the symbol-value function in the XLISP 2.0 manual.

  Back to Top

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