[plt-scheme] Re: Text-contents to a function variable
Stephen, you are right about the defining H as a scheme variable to
have the value of 1.
I'm going to answer as clearly as I can so that there is no confusion.
If anything that is not one of the scheme variables that was defined
before hand a message will pop up explaining the exact way (for
simplicity's sake) to use the text-field. (Do you think a giant
conditional is the way to go?)
I do not believe that the variables will clash because the value that
we get from the scheme variables will be used for a program that
checks certain combinations. Any instance where the entered value is
not the same, would bring up the error message explaining to check
what you wrote. Would you like to see what I have for my overall code
so far so you can better understand my problem?
On Jan 13, 10:56 am, Stephen Bloch <sbl... at adelphi.edu> wrote:
> On Jan 13, 2010, at 9:51 AM, Avi wrote:
>
> > 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
>
> Aha: we were being confused by "the letter has a pre-defined number". I think what you actually mean is that you've defined a Scheme variable named H to have the value 1, and when the user types the letter "H" into a text field, you want to use the value 1. And I presume you would want it to work for other variables too, e.g. if you had a Scheme variable named AGE with the value 30, and the user typed "AGE" into the text field, you would use the value 30. Right?
>
> Before discussing how to do this, let's clarify the problem. What should happen if the user types in " H" or "H " (that is, H with a space before or after it)? What should happen if the user types in "h"? What should happen if the user types in "x" (where there is no Scheme variable named x or anything like it)? What should happen if the user types in "27"?
>
> Here are some trickier questions. What should happen if a variable named x is defined after the code is written, but before the user types "x" into the text field? What should happen if the GUI program in which all this is happening has a parameter or a local variable named x, and the user types "x" into the text field?
>
> Stephen Bloch
> sbl... at adelphi.edu
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme