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

From: Avi (n4alpaca at gmail.com)
Date: Wed Jan 13 21:39:59 EST 2010

Perhaps I should send my code to someone if it is not too much
trouble. Anyone up for that? (if you do want to check it out I want to
use the contents of a-text-field to use my variable (the first thing
that you can see)(H...) to plug in the value of that variable into the
Molecule functions)

On Jan 13, 7:16 pm, Stephen Bloch <sbl... at adelphi.edu> wrote:
> On Jan 13, 2010, at 3:21 PM, Avi wrote:
>
> > 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.
>
> What is "before hand"?  Before you wrote the function that checks the  
> text field, extracts its contents, looks up the numeric value of that  
> variable, and passes the result to some function?  Or before that  
> function is called?  Does it include any Scheme variables that might  
> be defined (as parameters or locals) IN that function?
>
> Whatever you decide this means, you'll clearly need a way to find out  
> whether there is a variable with a specified name, so that if there  
> isn't, you can produce an error message.  That can be done, but it's  
> probably easier if your program maintains its own mapping of names to  
> values than if you try to use Scheme variables for this purpose.
>
> > (Do you think a giant conditional is the way to go?)
>
> Almost certainly not :-)
>
> > 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.
>
> But what if some local variable happens to have a value which would  
> be a legal input to that program?
>
> > Would you like to see what I have for my overall code
> > so far so you can better understand my problem?
>
> Actually, no :-)
>
> Stephen Bloch
> sbl... at adelphi.edu
>
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.