I’m trying to do something that would be very, very easy in TADS, but the Inform compiler doesn’t like the syntax I’m trying to use, and the Documentation does not, as far as I can see, explain how to do it.
This first line seems to compile (unless the compiler gave up before it got there, which is not likely since I put it near the top of the code):
A color is a kind of value. The colors are red, orange, yellow, green,
blue, violet, pink, and gray.
However, this code does not compile:
The rhinoceros-solution is a list of colors. Let rhinoceros-solution
be {pink, yellow, green, blue}.
(Note: There is no rhinoceros in the game. I’m obfuscating to avoid a spoiler.)
The compiler reports, Problem. The sentence ‘The rhinoceros-solution is a list of colors’ [This] reads to me as if ‘rhinoceros-solution’ refers to something I should create as brand new - a list of colors. But that can’t be right, because this is a kind of value where I can’t simply invent new values."
Well, yes, it IS correct, because I’m not inventing new values! I’ve already declared that the colors are a kind of value.
What I need is precisely what I’ve written: a list of four colors, which I will then need to compare to another list of four colors, and I don’t know how to do that either. Iterating through a list with a variable as a pointer to the entry in a list is probably something I can figure out myself … but then how do I compare the entry in one list with the entry in the other list? Using an equals sign? Why am I not confident that that will work?
I’m sorry, but this appears to be one of those cases where the Documentation fails by trying to be too friendly. It tries to guess what the author probably wants, rather than explaining precisely how the code can and cannot work.