# What is the name of this notation?

What is the name of a notation that looks as follows:

"1 2 9 8 4 6 + * / + *"


But is evaluated as "1 + 2 * 9 / 8 + 4 * 6"

EDIT: I do think it's RPN now and my eval above is incorrect (as it's supposed to be evaluated in the stack on the first occurrence of an operator after the first operand).

-
I don't know, but I'd call it "terrible", because there is no way to order operations. How would you write the computation $(1+2)*(3+4)$, for example? – Thomas Andrews Jul 10 '14 at 20:54
Where did you come across it? That might help us figure out what it's called. – Omnomnomnom Jul 10 '14 at 20:57
My apologies. I was asked this during an interview a few years ago and wanted to recreate the function that parses this and calculates it, but I forgot what the name of the notation is. Also, @ThomasAndrews you might be able to do 1 2 3 4 ( + ) * ( + ), though I'm not sure. If this does have a name, I'd appreciate if anyone is able to locate it, and if not, its totally cool too :) – jsanc623 Jul 10 '14 at 21:00
Are you sure that is how it should be evaluated? If 1 2 9 8 4 6 + * / + * were Reverse Polish, it would mean $1\cdot(2+\frac{9}{8\cdot(4+6)})$. – Henning Makholm Jul 10 '14 at 21:01
i suspect, but obviously can't prove, that you've forgotten the meaning of the notation, and that the interviewer actually was using Reverse Polish notation. This notation, as given, is not used anywhere, while RPN is quite common for a lot of computer science operations. – Thomas Andrews Jul 10 '14 at 21:03

The most likely explanation seems to be that you're misremembering the meaning of the notation, and that the interviewer actually was using Reverse Polish notation. This notation, as given, is not used anywhere, while RPN is quite common for a lot of computer science operations.

In RPN, 1 2 9 8 4 6 + * / + * would mean $$1\cdot\left(2+\frac{9}{8\cdot(4+6)}\right)$$ rather than your $$1 + \frac{2 \cdot 9}{8} + 4\cdot6$$

-
(Adapted from comments by myself and Thomas Andrews). – Henning Makholm Jul 10 '14 at 21:06

This is almost a version of Polish notation called Reverse (or postfix) polish notation, but with the operators in inverted order.

-
what OP is describing is not quite RPN. The only similarity is that the operations are written to the right of values. – Omnomnomnom Jul 10 '14 at 20:55
No, it is not reverse Polish. If this was RPN, then the first $+$ would apply to $4\,6$, which it doesn't. – Thomas Andrews Jul 10 '14 at 20:55

"Not practical " or "unusual", because that "all args first then all ops" notation would only work if the operators used all have a unique arity. So what about a - operator?

Also one would pile up much memory, no intermediate reductions.

-
It was more of an exercise in stack knowledge rather than something to be used in production. – jsanc623 Jul 10 '14 at 21:10