Hi, i recently started to learn programming in common-lisp, im reading
the book Ansi Common-Lisp, so about this two functions defparameter
and defconstant:
I use CLISP, i tried the following code
> (defparameter x 9) (x)
then i got an error, when i try to quote (x) instead, i got as the
result the symbol X, in both cases i was expecting to get 9 as the
result on the SLIME toplevel, i also tried to do the same things
substituting defparameter with defconstant and got the same results.
So my questions are: why that first code isnt valid? And whats the
difference between defparameter and defconstant? Apreciate any help,
thanks and sorry for any english mistake, its not my first language.
On Sat, 02 Jun 2007 18:49:19 -0700, ··············@yahoo.com.br said:
| ...
| so about this two functions defparameter
| and defconstant:
(As an terminological aside: they are special operators, in fact,
not functions.)
| I use CLISP, i tried the following code
| > (defparameter x 9) (x)
Try
> (defparameter x 9)
> x
since
> (x)
is a call to a function (or special operator) X (which you
(probably) do not intend to define).
| ...
| And whats the difference between defparameter and defconstant?
DEFPARAMETER defines a (global) variable, i.e. one which can be
bound to a different value at times (or even reassigned, if you are
that way inclined). DEFCONSTANT, as the name implies, defines a
constant, i.e. its value will always be the one given in the
DEFCONSTANT form.
---Vassil.
--
The truly good code is the obviously correct code.