From: Juan Pardillos
Subject: Convert a string into an atom.
Date: 
Message-ID: <6278687.0205131338.45c5c33a@posting.google.com>
Hello,

I need to convert a string into an atom.

What I want to do cannot be achived by
using the 'intern' function, as:

(setq a (intern "value-of-a"))

is not equivalent to:

(setq a 'value-of-a)

How can I convert the string "value-of-a" into the
atom 'value-of-a?. Please, help.

Thanks in advance

From: Coby Beck
Subject: Re: Convert a string into an atom.
Date: 
Message-ID: <ADXD8.68616$uE2.5161347@news2.calgary.shaw.ca>
Juan Pardillos <·······@eresmas.com> wrote in message
································@posting.google.com...
> Hello,
>
> I need to convert a string into an atom.
>
> What I want to do cannot be achived by
> using the 'intern' function, as:
>
> (setq a (intern "value-of-a"))
>

Yes, you did produce a symbol from a string.

> is not equivalent to:
>
> (setq a 'value-of-a)

Only because or the default settings of the lisp reader.

> How can I convert the string "value-of-a" into the
> atom 'value-of-a?. Please, help.

try:
(intern (string-upcase "value-of-a"))

Better advice (aside from "consult some lisp references about symbols")
can't be given without knowing what you really want to use this code for.

--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")

--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")
From: Paul Foley
Subject: Re: Convert a string into an atom.
Date: 
Message-ID: <m2helbqv9y.fsf@mycroft.actrix.gen.nz>
On 13 May 2002 14:38:25 -0700, Juan Pardillos wrote:

> Hello,
> I need to convert a string into an atom.

A string is already an atom.  Everything that's not a cons is an atom.

> What I want to do cannot be achived by
> using the 'intern' function, as:

It can be achieved with the IDENTITY function :-)

> (setq a (intern "value-of-a"))

> is not equivalent to:

> (setq a 'value-of-a)

The reader upcases symbol names, by default, so you want to use
(intern "VALUE-OF-A"), not (intern "value-of-a").  But even if you do
that, it'll get interned in whatever package is current at run-time,
which may not be the same package as was current at read-time.

(setq a (intern (string-upcase "value-of-a") #.*package*))

-- 
If that makes any sense to you, you have a big problem.
                                      -- C. Durance, Computer Science 234
(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(··@) "actrix.gen.nz>"))