[plt-scheme] Re: Text-contents to a function variable
On Wed, Jan 13, 2010 at 5:27 PM, Avi <n4alpaca at gmail.com> wrote:
> If i knew enough scheme, I'm sure I would appreciate that code the you
> have there, but I do not. However, I think I know enough see that you
> have restricted the inputs and outputs, and I do not want that, I just
> want a way to plug in a letter that I defined as a number into a
> function variable that I wrote.
Avi, if only some letters or words have been defined as numbers, then
the inputs are restricted to those letters and words. In my program,
I have defined "cat" as 10, "dog" as 20, "bird" as 30, and "mouse" as
40. The way I defined them was by putting them in a hash table.
Because I did not define any other words, the inputs are restricted to
"cat", "dog", "bird", and "mouse". Unless you assign a number to
every possible word, your inputs will be restricted.
The program I wrote is the simplest one I can come up with that does
what you asked for, or if I got it wrong, then at least something like
what you asked for. If you can't read it, I would suggest starting
learning Scheme with a simpler task. You seem to be in a bit over
your head, and I think you will make more progress on a task where you
can ask questions that we can understand, and we can give answers that
you will understand. My favorite place to suggest for new Scheme
programmers is How to Design Programs (www.htdp.org), but maybe you
have already seen that or would like other suggestions from people on
the mailing list.
--Carl