Pondering the philosophy behind the language
-
cameyo
- Posts: 183
- Joined: Sun Mar 27, 2011 3:07 pm
- Location: Italy
-
Contact:
Post
by cameyo »
These expressions generate an error:
Code: Select all
(set '"name") -> ERR: symbol expected in function set : '"name"
(set (quote "name") 3) -> ERR: symbol expected in function set : '"name"
But the following are valid (then "name" is a valid symbol):
Code: Select all
(setf '"name" 3) -> 3
(setq "name" 3) -> 3
Now the problem: how to retrieve the value of the symbol "name"?
Code: Select all
(setq a "name")
(println a) -> "name"
Thanks
-
fdb
- Posts: 66
- Joined: Sat Nov 09, 2013 8:49 pm
Post
by fdb »
Hi, I presume you want to convert a string into a symbol , which can be done like this:
If you however want to convert "name" including quotes into a symbol then use this code:
and to retrieve the value from "name":
-
cameyo
- Posts: 183
- Joined: Sun Mar 27, 2011 3:07 pm
- Location: Italy
-
Contact:
Post
by cameyo »
You solve my question with:
Thanks fdb :-)