Can we all agree that polish/prefix notation is objectively superior to infix notation?
Can we all agree that polish/prefix notation is objectively superior to infix notation?
silence means assent
No that's stupid and unnecessary
I can agree with that, my brain finds it easier to work with and it's a lot more compact. The only problem is I can't use it in exams for some stupid reason...
Lost a '2' there buddy
No, it's better to have infix notation and 18 levels of operator's precedence.
No
postfix > prefix
I will agree that both are better than infix though.
Did someone just get done reading the first chapter of SICP?
(* (/ 1 (sqrt (* 2 π ) ) sigma) (exp (* -1/2 (pow (/ (- x µ) sigma ) 2))))
Real superior. There's a reason we don't usually use it.
Your example looks good because it has less operators so it's shorter. But how about this:
(3-5)*((7+2)/9)
Is the same as
(* (- 3 5) (/ (+ 7 2) 9))
I think it looks uglier imho desu senpai
Top one looks like it'd be nice for situations like that one specifically - one operator, a bunch of things to operate on.
Multiple different operations would be a garbled mess to comprehend compared to using the bottom one.
Yeah
Why the fuck would you use parentheses with the polish notiation? The whole point is not having to write them.
Do you also prefer your programming languages to look like (3, 2, 1, "%d %d %d").printLn.stdout
No, there's a place for everything
How would that user write that equation as you describe it then? The only thing I can see you doing is removing the outmost parentheses.
Seriously curious.
The only way I could think of is this:
* / + 7 2 9 - 3 5
But the only reason it works is because of the Commutative Property of Multiplication.
Basicly just omitting all of them works, so
* - 3 5 / + 7 2 9
works just as well
Are you retarded? Post- and prefix are unambiguous. There are no more than one way to derive them.
because * and + are n-adic functions.
* / + 7 2 9 - 3 5
* / 9 9 - 3 5
* 1 - 3 5
* 1 -2
-2
* - 3 5 / + 7 2 9
* -2 / + 7 2 9
* -2 / 9 9
* -2 1
-2
----------------
Don't ask, I was bored.
Afaik the elementary arithmetic operators are assumed to be binary.
the only thing that matters is getting the right solution to a problem
how you get there doesn't matter