[plt-scheme] (string->symbol string) not working with MrEd

From: Luis Coronado (minquartia at gmail.com)
Date: Sun Jun 5 21:23:59 EDT 2005

Dear plt-list, I have the following problem with a piece of code I'm
writing and I haven't been able to find a solution yet.

I have a dialog with some controls some of which are choice% objects. I
use this code to retrieve the values given by the user:

note: "tipo_lados" is an choice% object I defined somewhere else in the
code.

I send the object the following messages:

> (send tipo_lados get-string-selection)
"hospital"

This is ok, and exactly what I wanted. But now I want to change that
string into a symbol, so:

> (string->symbol (send tipo_lados get-string-selection))
|hospital|

And that is the first time I see this. Is that a symbol? yes it is:
> (symbol? (string->symbol (send tipo_lados get-string-selection)))
#t

But is that symbol the same as converting the same string "hospital"
returned by the get-string-selection method from the tipo_lados choice%
object with (string->symbol "hospital")?:

> (string->symbol "hospital")
hospital

> (equal? (string->symbol "hospital") (string->symbol (send tipo_lados
get-string-selection)))
#f

I don't understand why that fails if it is the same string. Unless the
string returned by the choice% object is different in some way.

I'm using drscheme 209 linux x86 (Graphical (MrEd, includes MzScheme))

Any pointers here would be greatly appreciated.

Note: probably the same message was sent to the list but with an
incorrect email address. Apologies for the inconvenience.

-- 
Luis Coronado <minquartia at gmail.com>



Posted on the users mailing list.