From: anusha
Subject: how to assign a list to a number?
Date: 
Message-ID: <111057a7e6d63cf129bc2f94e3c7cf12@localhost.talkaboutprogramming.com>
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.

From: Trent Buck
Subject: Re: how to assign a list to a number?
Date: 
Message-ID: <20050201002911.131246b5@harpo.marx>
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.
From: Pascal Bourguignon
Subject: Re: how to assign a list to a number?
Date: 
Message-ID: <873bwhis8j.fsf@thalassa.informatimago.com>
"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.