In viewing the Specs for the RPN exercise, if I have the following stack:
[2, 3, 4, +]
and evaluate it I should get 7 back.
However, according to wikipedia and basic logic, this should actually result in an error because after applying the plus operator you will have a stack with 2 terms left [2, 7] and no operators. The value method of the RPN should evaluate the entire stack as it exists. I don’t see why is expects to only evaluate a single term.
This doesn’t seem to mesh with the test on line 98 “resolves operator precedence unambiguously”. In that test, when running value it expects the entire input to be evaluated.
Can someone help me understand which behavior is correct?