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

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Jun 6 10:32:24 EDT 2005

The vertical bars are usually placed around the symbol when it contains
uppercase letters, but that does not seem to be the case in the code
you wrote below. 

I wrote a little program, based on what you write in your email and
couldn't get that behavior. Perhaps you can make your own little,
complete program? If so, we may be able to help more effectively.


(define f (new frame% (label "")))
(define tipo_lados (new choice% 
                        (parent f)
                        (label #f)
                        (callback void)
                        (choices '("hospital"))))

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

At Sun, 05 Jun 2005 19:23:59 -0600, Luis Coronado wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 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.