This link has been bookmarked by 9 people . It was first bookmarked on 15 Oct 2007, by Jay Dugger.
The expression for adding the numbers 1 and 2 is, in prefix notation, written "+ 1 2" rather than "1 + 2". In more complex expressions, the operators still precede their operands, but the operands may themselves be nontrivial expressions including operators of their own. For instance, the expression that would be written in conventional infix notation as
(5 − 6) * 7
can be written in prefix as
* (− 5 6) 7
Since the simple arithmetic operators are all binary (at least, in arithmetic contexts), any prefix representation thereof is unambiguous, and bracketing the prefix expression is unnecessary. As such, the previous expression can be further simplified to
* − 5 6 7
The processing of the product is deferred until its two operands are available (i.e., 5 minus 6, and 7). As with any notation, the innermost expressions are evaluated first, but in prefix notation this "innermost-ness" can be conveyed by order rather than bracketing.
In the classical notation, the parentheses in the infix version were required, since moving them
5 − (6 * 7)
or simply removing them
5 − 6 * 7
would change the meaning and result of the overall expression, due to the precedence rule.
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.