From: Andreas DIETZ
Subject: [Q] How to make a symbol which *exactly* corresponds to a given string?
Date:
Message-ID: <ul8ohp2ubau.fsf@merlot.lirmm.fr>
Hello,
please excuse me if the answer to this question should be obvious.
I have tried the following two:
(make-symbol "foo") ==> #:|foo|
(intern "foo") ==> |foo|
Given the characters inbetween the quotes of a string, I wish to
obtain a symbol made up of these characters and nothing more. That is,
the second method using INTERN would be perfect if there were not the
vertical bars ...
Any hints would be greatly appreciated. Thank you in advance.
Andreas
--
Andreas DIETZ
LIRMM email : ·····@lirmm.fr
161 rue Ada Tel : (33) 67 41 85 80
34392 Montpellier Cedex 5 Fax : (33) 67 41 85 00
From: Antonio Leitao
Subject: Re: [Q] How to make a symbol which *exactly* corresponds to a given string?
Date:
Message-ID: <wok9zhzxsn.fsf@sol.gia.ist.utl.pt>
>>>>> "Andreas" == Andreas DIETZ <·····@lirmm.fr> writes:
Andreas> Hello,
Andreas> please excuse me if the answer to this question should be obvious.
Andreas> I have tried the following two:
Andreas> (make-symbol "foo") ==> #:|foo|
Andreas> (intern "foo") ==> |foo|
Andreas> Given the characters inbetween the quotes of a string, I wish to
Andreas> obtain a symbol made up of these characters and nothing more. That is,
Andreas> the second method using INTERN would be perfect if there were not the
Andreas> vertical bars ...
Andreas> Any hints would be greatly appreciated. Thank you in advance.
Andreas> Andreas
Most probably, your Lisp uppercases symbol names (as most Lisps
do). Whether you write foo, Foo, FoO or FOO is irrelevant to Lisp. It
just interns a symbol whose print name is "FOO" (but writes it back in
lowercase).
(symbol-name 'foo) ==> "FOO"
(symbol-name 'FoO) ==> "FOO"
(symbol-name '|foo|) ==> "foo"
To solve your problem, try:
(intern "FOO")
and you should get:
==> foo
Good Luck
Antonio Leitao