I ran into an issue that looks like a compiler issue involving interpretation of equation formulae:
"Equation Issue"
Place is a room.
When play begins:
let A be 10;
let B be 5;
let c be given by c=(A+2)/(B+1) where c is a number;
say "c = [c]."
The Problem message is:
Problem. You wrote ‘let c be given by c= (A+2)/ (B+1) where c is a number’ : but this is a phrase which I don’t recognise, perhaps because it uses brackets ‘(’ and ‘)’ or braces ‘{’ and ‘}’ in a way that doesn’t make sense to me. Each open ‘(’ or ‘{’ has to have a matching ‘)’ or ‘}’.
This isn’t a serious attempt at an answer but could it be related to escaping special characters? There’s a lot of programming languages where /( behaves differently than (, and none of the sample formulas have a denominator in parentheses.
Yeah, the I7 compiler is frequently very finicky about spaces around arithmetic operators, so to avoid frustration I now always try to remember to separate them with a space front and back.
In this case, as it happens, the only change needed from your version is a space before the slash.
I think you’re on to something here, mathbrush. The Problem message does reference the possibility that there are unbalanced parentheses, which implies that one of the parentheses is being read as something else. It also seems that adjacency of the slash and parenthesis are important, because the issue can be bypassed with spacing.
What doesn’t makes sense to me is that putting a space before the slash is the minimum change needed to avoid the error. It seems as though the )/ is being read as a unit instead of the /(.
This definitely doesn’t seem like correct behavior to me, though. I haven’t found anything in the documentation to suggest that a forward slash can be part of any kind of escape sequence.
This also seems to be indicated by the error message, which inserts a space after the / but not before:
Problem. You wrote ‘let c be given by c= (A+2)/ (B+1)
I think this must be simply a compiler bug in the equation-reader, and as a result of it the )/ is not being recognised as a ) followed by a /, hence comments about mismatched brackets.