From: Jonathon McKitrick
Subject: How can I convert a string into a quote-value?
Date: 
Message-ID: <1139784887.909698.212300@g47g2000cwa.googlegroups.com>
I have a function called with a database column name and a value.

CLSQL expects the column name to be either a quote-value or a
colon-value.  Since I don't know how many columns I will have in each
of these tables, I want to take the column name argument and
concatenate it to the letter 'q' to produce column names q1, q2, q3,
etc.  I need something that will go the opposite way from symbol-name.
Rather than convert 'q1 to "q1", I want to convert "q1" to 'q1.... I
think.

Any ideas?  If I knew how many columns there would be, I could just
make a list as a global variable.  But I don't, and one of the tables
will have over 400 columns anyway.

From: Jonathon McKitrick
Subject: Re: Nevermind... I *think* (intern) is what i want (np)
Date: 
Message-ID: <1139785439.675056.19340@z14g2000cwz.googlegroups.com>
....
From: jayessay
Subject: Re: How can I convert a string into a quote-value?
Date: 
Message-ID: <m3oe1c3zq0.fsf@rigel.goldenthreadtech.com>
"Jonathon McKitrick" <···········@bigfoot.com> writes:

> Rather than convert 'q1 to "q1", I want to convert "q1" to 'q1.... I
> think.

Well, if you really do want to do this, you want INTERN.  Just make
sure the casing matches what you have/expect.  For your example,
assuming standard reader case, you would have

(intern "Q1") or if the strings are being computed:

(intern (string-upcase the-string))


/Jon

-- 
'j' - a n t h o n y at romeo/charley/november com
From: Alan Manuel K. Gloria
Subject: Re: How can I convert a string into a quote-value?
Date: 
Message-ID: <1139794809.957193.10560@f14g2000cwb.googlegroups.com>
It appears what your package wants is a "symbol".

Now, all the code you write in Lisp is, in fact, data that can be
manipulated within Lisp.  Anything within parenthesis is a list: (1 2
3).  Anything within double-quotation marks is a string: "foo".  Things
that begin with # have special meaning - arrays for example: #(4 5 6).
Numbers are numbers.  And anything that is composed of a string of
characters is a symbol.

So, let's say you do:
(defun foo (x)
    (+ x 1))

What you are actually inputting to the Lisp evaluator is a list:
1. DEFUN
2. FOO
3. a list:
3.1 X
4. a list:
4.1 +
4.2 X
4.3 a number: 2

Now, the default evaluation of a list is to "apply" everything from 2->
onwards to the symbol in 1.  In this case, applying 2-> onwards to
DEFUN results in a function named FOO, taking a parameter X, whose
content is a function call to +.

The default evaluation of a symbol, on the other hand, is to return the
value of the variable represented by that symbol.

The interesting part is when you use '

The quote symbol ' means "don't evaluate".  So, if you do '(foo 1), FOO
doesn't get called.  The entire form is simply returned without being
evaluated.  In fact, when you type something like 'q0, what is returned
is actually the symbol Q0, instead of any putative variable that exists
at that point that also happens to be named Q0.

A symbol, which is used as a variable name, is just another kind of
data object in Lisp, in much the same way that a function is just
another kind of data object that you can pass around and do stuff to.

Basically, what the INTERN function does is, it inputs a string and
returns the symbol that the string represents.

Hope you understood that ;)
From: Peter Scott
Subject: Re: How can I convert a string into a quote-value?
Date: 
Message-ID: <1139800178.188682.55990@o13g2000cwo.googlegroups.com>
Of, if you don't want to pollute your package with lots of symbols, you
can use MAKE-SYMBOL. This generates uninterned symbols from strings.

(make-symbol "foo") => #:|foo|