Talk:Parsing/RPN to infix conversion: Difference between revisions

Line 12:
::: Recommendation: Replace the example case with one that would exhibit the problem, or add a second example case which would exhibit the problem. Require that the RPN and infix forms expressions evaluate equally. --[[User:Short Circuit|Michael Mol]] 15:33, 17 December 2011 (UTC)
:::: I added an extra example, now sadly all the tasks are wrong (although I think a couple already address this). The task already requires the RPN and infix to be the same. One thing, I can't find the template that says (globally) the task changed. So I'll have to mark them all incorrect if I can't find one. --[[User:Dgamey|Dgamey]] 16:49, 17 December 2011 (UTC)
:: Huh, if you want minimum parentheses and follow the [[wp:Associativity|actual definition]] of associativity, the task itself is incorrect: - and / are non-associative. The term "left-associative" is often loosely used when parsing infix notations, to determine the order of ops in absence of parens, but to do the reverse and requiring minimum number of parens, this kind of definition of associativity is not enough, and you need to know the exact behaviour of the operators (a + b + c requires none, but a - b - c may need one pair, even though both + and - are both loosely "left associative"). The task needs some more work, or there may be other holes after people try to fix the solutions. --[[User:Ledrug|Ledrug]] 17:50, 17 December 2011 (UTC)
 
== New Input examples ==
See 'Examples Incorrect' above. An example was added to show that associativity is correctly handled. --[[User:Dgamey|Dgamey]] 16:49, 17 December 2011 (UTC)
Anonymous user