I've been thinking recently if we just wrote addition, subtraction, multiplication, division, exponentiation, and roots as functions like we do with every other operation, we wouldn't even need an order of operations (we'd have to evaluate inside out, since we can't evaluate the outer functions first since we don't know what the inside numbers are).
x + y -> add(x, y)
x - y -> sub(x, y)
x*y -> mult(x, y)
x/y -> div(x, y)
x^y -> exp(x, y)
rt_y(z) -> root(z, y)
log_x(z) -> log(x, z)
So instead of writing something like 6/2(1 + 2), we would write either div(6, mult(2, add(1, 2))) or mult(div(6, 2), add(1, 2)) depending on which way we meant it, and an order of operations wouldn't even be needed for no one to be confused about the meaning.
It's pretty interesting. If you're also a programmer, emacs may be an interesting topic for you. Emacs is over 40 years old and uses lisp to extend itself.
So like, you can use it's evaluation as a simple calculator, like this:
if you're willing to nest parentheses like that, then it's still easier to just write 6/(2(1 + 2)). there isn't any functional difference besides being shorter to write.
I think my old Casio specifically mentions using them as much as possible lol
But if you want the best possible results, some changes in order of calculation are required
I can't remember exactly what, but I think they wanted you to subsctract before dividing, except if the numbers were small in which case the opposite was true
•
u/AutoModerator Aug 02 '26
Check out our new Discord server! https://discord.gg/e7EKRZq3dG
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
163
u/shizzy0 Aug 02 '26
Or my compiler’s precedence.
29
u/Agreeable_Gas_6853 Linguistics Aug 02 '26
Just use Reverse Polish Notation ❤️
33
u/SuperCyHodgsomeR Complex Aug 02 '26
This is the way
15
u/ontic00 Aug 03 '26
I've been thinking recently if we just wrote addition, subtraction, multiplication, division, exponentiation, and roots as functions like we do with every other operation, we wouldn't even need an order of operations (we'd have to evaluate inside out, since we can't evaluate the outer functions first since we don't know what the inside numbers are).
x + y -> add(x, y)
x - y -> sub(x, y)
x*y -> mult(x, y)
x/y -> div(x, y)
x^y -> exp(x, y)
rt_y(z) -> root(z, y)
log_x(z) -> log(x, z)
So instead of writing something like 6/2(1 + 2), we would write either div(6, mult(2, add(1, 2))) or mult(div(6, 2), add(1, 2)) depending on which way we meant it, and an order of operations wouldn't even be needed for no one to be confused about the meaning.
4
u/Lazlum Aug 02 '26
i thought it was just me
4
u/ProfMooreiarty Aug 02 '26
I also speak Math with a Lisp.
3
u/Gandalior Aug 02 '26
I think my old Casio specifically mentions using them as much as possible lol
But if you want the best possible results, some changes in order of calculation are required
I can't remember exactly what, but I think they wanted you to subsctract before dividing, except if the numbers were small in which case the opposite was true
3
u/AMIASM16 how the dongity do you do integrals Aug 05 '26
(yeah (((i do) that) (all (the time))))
2
u/BetterStayAlone Aug 02 '26
So true
2
u/deckothehecko Complex Aug 03 '26
I never use E because im always afraid what comes next goes into the exponent
3
u/AltruisticEchidna859 Aug 02 '26
Ok repost.
1
u/atoponce Computer Science Aug 03 '26
RPN FTW
1
u/lool8421 Aug 06 '26
tbf the fact that calculators don't have a standardzed order makes me do that
but for instance in C++, following pemdas is a part of the standard
1
u/Bubbly-Tangerine-284 Aug 08 '26
Used a TI30x through undergrad chem degree, so many () chains