Peter Drake, he/him, LFHCfS 🔥 on Nostr: npub1zdp33…2vqv8 Apologies if I'm telling you things you already know, but since ...
npub1zdp33shl69xr0uq3x8n5gsjykq9upycwh6nqm02c3f6x0frrn0dq42vqv8 (npub1zdp…vqv8) Apologies if I'm telling you things you already know, but since you asked...
"The normal way" is infix (2 + 3), as in C, Java, and Python. Polish notation is prefix (+ 2 3), as in Lisp. RPN is postfix (2 3 +), as in PostScript, Forth, and old HP calculators.
I've heard that it's only called "Polish" because English-speaking mathematicians couldn't pronounce "Łukasiewicz", but that may be apocryphal.
Bonus tidbits:
It is argued that both prefix and postfix are better than infix, because you don't need parentheses or operator precedence rules. * + 2 3 4 is unambiguous, but without precedence rules 2 + 3 * 4 could mean (2 + 3) * 4 or 2 + (3 * 4).
Ironically, Lisp is mocked for seeming to consist entirely of parentheses. (This is because the previous statement doesn't hold with variable-arity functions.)
"The normal way" is infix (2 + 3), as in C, Java, and Python. Polish notation is prefix (+ 2 3), as in Lisp. RPN is postfix (2 3 +), as in PostScript, Forth, and old HP calculators.
I've heard that it's only called "Polish" because English-speaking mathematicians couldn't pronounce "Łukasiewicz", but that may be apocryphal.
Bonus tidbits:
It is argued that both prefix and postfix are better than infix, because you don't need parentheses or operator precedence rules. * + 2 3 4 is unambiguous, but without precedence rules 2 + 3 * 4 could mean (2 + 3) * 4 or 2 + (3 * 4).
Ironically, Lisp is mocked for seeming to consist entirely of parentheses. (This is because the previous statement doesn't hold with variable-arity functions.)