[plt-scheme] Re: Text-contents to a function variable

From: Avi (n4alpaca at gmail.com)
Date: Wed Jan 13 09:51:02 EST 2010

I'm sorry for being vague. What I want to do is take a letter that is
typed into a text-field in a GUI (the letter has a pre-defined number)
and plug the letter into a function.

H is typed into a text field -> H=1 (pre-defined as 1) -> plug 1 into
a function

On Jan 13, 9:08 am, Thomas Chust <ch... at web.de> wrote:
> 2010/1/13 Avi <n4alp... at gmail.com>:
> > [...] I tried defining a letter as the
> > numerical value of a string, but it did not work very well, maybe
> > there are better methods? [...]
> Hello Avi,
> I don't understand what you mean by this.
> Do you want to convert a number representing a code point and which is
> encoded as a string into a character? In that case something like
> (integer->char (string->number "1234")) will do the job.
> Or do you have a string containing something else than digits and want
> to convert it into a number? In that case you will have to write a
> custom conversion function, since the standard library functions don't
> know how you want to interpret the characters.
> Or maybe the number you are given in string representation just isn't
> decimal? Then using the second, optional, parameter of string->number
> will help, eg. (string->number "deadbeef" 16).
> Ciao,
> Thomas
> --
> When C++ is your hammer, every problem looks like your thumb.
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.