define a parameter
(defparameter <sym> <val> [<comment>])
fsubr.
<sym> the symbol (will be marked special)
<val> the value
<comment> optional comment string (ignored)
returns the value
define a variable
(defvar <sym> [<val> [<comment>]])
fsubr. Variable only initialized if not previously defined.
<sym> the symbol (will be marked special)
<val> the initial value, or NIL if absent.
<comment> optional comment string (ignored)
returns the current value
set the global value of a symbol
(set <sym> <expr>)
You can also use (setf (symbol-value <sym>) <expr>)
<sym> the symbol being set
<expr> the new value
returns the new value
set the value of a symbol
(setq [<sym> <expr>]...)
fsubr. You can also use (setf <sym> <expr>)
<sym> the symbol being set (quoted)
<expr> the new value
returns the last new value or NIL if no arguments
전역변수
(
defparameter *
var_name*
value) 마지막에 정의된것으로 변경가능
(
defvar *
var_name*
value) 처음 정의된것으로 고정
> (defparameter *a* 1)
*a*
> *a*
1
> (defparameter *a* 2)
*a*
> *a*
2 |
> (defvar*a* 1)
*a*
> *a*
1> (defvar *a* 2)
*a*
> *a*
1
|
지역변수
(let ((variable_declarations)) (body)
> (let ((*a* 5)) (princ *a*))
5
5
> *a*
1 |