[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: number->string->symbol problem
Because
'25
is not a symbol, it is a number.
> (number? '25)
#t
> (symbol? '25)
#f
Quote does not make everything a symbol, just alphabetic things
(roughly). For example, this:
'(1 2 3)
is a list of three numbers.
If you want a symbol whose printed representation is 25, you can write
this:
'|25|
The bars mean "I don't care what is inside, this thing is a symbol".
Then,
> (eq? (string->symbol (number->string 25)) '|25|)
#t
Hope that helps,
Robby
At Fri, 8 Mar 2002 23:01:52 +0100, "Wouter Van den Broeck" wrote:
> hey,
>
> I have a small issue, which can be summarized as follows: why does the
> following line of code return false? (DrScheme v103 win2K)
>
> (eq? (string->symbol (number->string 25)) '25)
>
> TIA
>
> wouter
>
>