From: piscesboy on
Suppose I have a function that returns the name of the variable as a
literal value say 'date.

There is a variable of that same name whose value I want to get to.
How do I coerce 'date into the variable date so that I can get it's
value ie:

(value date) -> "1/31/2010"

from the literal 'date?
From: refun on
In article <b32720c7-9626-43c3-aad9-
86e2c1cb9a1d(a)n7g2000yqb.googlegroups.com>, oraclmaster(a)gmail.com says...
>
> Suppose I have a function that returns the name of the variable as a
> literal value say 'date.
>
> There is a variable of that same name whose value I want to get to.
> How do I coerce 'date into the variable date so that I can get it's
> value ie:
>
> (value date) -> "1/31/2010"
>
> from the literal 'date?

If DATE was a (global) symbol with a value, you could use (symbol-value
'date), but if you want to use the exact syntax "(value date"), write a
macro like:
(defmacro value (symbol) `(symbol-value ',symbol))

CL-USER> (defparameter *date* "1/31/2010")
*DATE*
CL-USER> (value *date*)
"1/31/2010"

It won't work on lexical variables obviously.

What is the underlying purpose of this? There might be a better way to
do things.
From: Paul Donnelly on
piscesboy <oraclmaster(a)gmail.com> writes:

> Suppose I have a function that returns the name of the variable as a
> literal value say 'date.

I suspect the answer is "don't do that".

> There is a variable of that same name whose value I want to get to.
> How do I coerce 'date into the variable date so that I can get it's
> value ie:
>
> (value date) -> "1/31/2010"
>
> from the literal 'date?

If you really need to look things up by symbol, why not use a data
structure you can index by name? There's no hackery involved making
lookups in an alist or a hash table. This looks an awful lot like the
classic "make twenty variables instead of an array" mistake. Apologies
if you really do know what you're doing.
From: piscesboy on
On Jan 21, 10:11 pm, refun <re...(a)nospam.gmx.com> wrote:
> In article <b32720c7-9626-43c3-aad9-
> 86e2c1cb9...(a)n7g2000yqb.googlegroups.com>, oraclmas...(a)gmail.com says...
>
>
>
> > Suppose I have a function that returns the name of the variable as a
> > literal value say 'date.
>
> > There is a variable of that same name whose value I want to get to.
> > How do I coerce 'date into the variable date so that I can get it's
> > value ie:
>
> > (value date) -> "1/31/2010"
>
> > from the literal 'date?
>
> If DATE was a (global) symbol with a value, you could use (symbol-value
> 'date), but if you want to use the exact syntax "(value date"), write a
> macro like:
> (defmacro value (symbol) `(symbol-value ',symbol))
>
> CL-USER> (defparameter *date* "1/31/2010")
> *DATE*
> CL-USER> (value *date*)
> "1/31/2010"
>
> It won't work on lexical variables obviously.
>
> What is the underlying purpose of this? There might be a better way to
> do things.

That's what I needed. Thanks. It's just for a simple function I need
to keep track of the variables I've set in the user package so I don't
need to remember which ones are bound and which ones are not.
From: fortunatus on
On Jan 21, 10:59 pm, piscesboy <oraclmas...(a)gmail.com> wrote:
> ... It's just for a simple function I need
> to keep track of the variables I've set in the user package so I don't
> need to remember which ones are bound and which ones are not.

Don't forget BOUNDP, FBOUNDP.