Generally when we want to assign a list to a symbol we use
(SETQ A '(FILL IN)) or
(SETF (GET 'A 'VALUE) '(FILL IN))
Here A is assigned (FILL IN).
Now if I want to assign (FILL IN) to a number(for ex. 1) what should I
do?
Thanks,
Anusha.
Up spake anusha:
> Generally when we want to assign a list to a symbol we use
> (SETQ A '(FILL IN)) or
> (SETF (GET 'A 'VALUE) '(FILL IN))
>
> Here A is assigned (FILL IN).
> Now if I want to assign (FILL IN) to a number(for ex. 1) what should I
> do?
You mean "(setf a 1)"?
(setf a 1)
=> 1
a
=> 1
--
-trent
In my country, I'm a real sex object.
Whenever I ask girls for sex, they object.
"anusha" <················@nospam.yahoo.co.in> writes:
> Generally when we want to assign a list to a symbol we use
> (SETQ A '(FILL IN)) or
> (SETF (GET 'A 'VALUE) '(FILL IN))
> Here A is assigned (FILL IN).
> Now if I want to assign (FILL IN) to a number(for ex. 1) what should I
> do?
You cannot.
You have two choices:
- assign the value to a symbol whose name is a string containing the
digits of the number:
(defparameter |1| '(fill in))
\1 --> (FILL IN)
(Note that 1.0 = 1, and #x1 = 1
but (not (eq '|#x1| '|1|))
and (not (eq '|1.0| '|1|))
etc...)
- _associate_ the number to the value, using some data structure such
as an array, a hashtable, an a-list, etc:
(defparameter *map* (make-hash-table))
(setf (gethash 1 *map*) '(fill in))
(gethash 1 *map*) --> (FILL IN)
(defparameter *map* (make-array '(100)))
(setf (aref *map* 1) '(fill in))
(aref *map* 1) --> (FILL IN)
(defparameter *map* '())
(setf *map* (acons 1 '(fill in) *map*))
(cdr (assoc 1 *map*)) --> (FILL IN)
--
__Pascal Bourguignon__ http://www.informatimago.com/
Kitty like plastic.
Confuses for litter box.
Don't leave tarp around.