string->symbol escaping numbers
"Lawrence Woodman" <[email protected]>
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <D2TG1HDYZSXR.3I7BV51H4RQ3Z@thinky> |
Hello,
I'm confused by string->symbol escaping the symbol when used with a string
consisting soley of a number:
(string->symbol "3") => |3|
(eq? (string->symbol "3") 3) => #f
I've looked but can't find a reason for its being escaped. It would be
great if someone could explain or point my in the direction of
somewhere that explains what is happening here.
The reason this is important to me is because I want to use memq in a
cond to handle various inputs a bit like this with itemtype as a symbol:
(cond ((memq itemtype '(text 0))
(list "0" username selector hostname port))
((memq itemtype '(menu 1))
(list "1" username selector hostname port))
((memq itemtype '(error 3))
(list "3" username selector hostname port)))
There are workarounds I could make such as comparing against strings but
ideally I would like to pass itemtype around as a symbol. Is there an
idiomatic way of handling this situtation?
Best wishes
Lorry