slack1
2020-4-16 18:32:08

Do people have any quick intuitions on the ergonomic differences between polish and reverse polish notation for simple physical calculators?



hazemalhalabi
2020-4-16 18:40:44

Seems to indicate reverse polish notation is better (ergonomically)


hazemalhalabi
2020-4-16 18:41:50

My initial intuition was to prefer polish notation because I’m more used to it


slack1
2020-4-16 18:42:23

But they seem to compare Reverse Polish Notation vs. Algebraic notation, which I assume is normal algebra with operator precedence


slack1
2020-4-16 18:42:52

I am also leaning towards reverse polish notation, but I was just curious about the polish notation side since that’s how Lisp writes things


slack1
2020-4-16 18:43:01

This is just for a toy calculator project


hazemalhalabi
2020-4-16 18:43:02

oh damn, I mis-read


hazemalhalabi
2020-4-16 18:43:09

yeah you’re right


hazemalhalabi
2020-4-16 18:43:25

maybe implement a switch for both modes


hazemalhalabi
2020-4-16 18:43:32

and see which one is more fun to use :stuck_out_tongue:


slack1
2020-4-16 18:43:41

thanks ^.^


slack1
2020-4-16 18:44:09

Have you personally used a reverse polish notation calculator? Such as from HP?


slack1
2020-4-16 18:44:23

or do you use forth or something


hazemalhalabi
2020-4-16 18:45:01

I’ve never used reverse polish notation in a calculator


hazemalhalabi
2020-4-16 18:45:24

Until this moment I didn’t know I could buy a reverse polish notation calculator


hazemalhalabi
2020-4-16 18:45:40

now I’m tempted to get one xD


slack1
2020-4-16 18:45:52

It’s lame but I want to build a physical calculator lol


hazemalhalabi
2020-4-16 18:46:19

I think it’s cool to build stuff


hazemalhalabi
2020-4-16 18:47:06

BTW I think there is a specific case where polish notation might be easier than reverse polish


hazemalhalabi
2020-4-16 18:48:23

actually nvm it doesnt make sense


hazemalhalabi
2020-4-16 18:48:26

oops xD


slack1
2020-4-16 18:48:37

mmm well I do assume that language designers have an intuition on this stuff lol


soegaard2
2020-4-16 18:50:08

The HP calculators were pretty popular back in the day. They used reverse polish notation.


hazemalhalabi
2020-4-16 18:50:21

i think it also relates to the spoken language of the user. In spoken language where verb always precedes the subject(s), polish notation might feel more natural (add one and two) vs (one and two add) In languages where the verb can be placed at the end (like German?), reverse polish notation might feel more comfortable


hazemalhalabi
2020-4-16 18:51:16

Either way one of the things that really bug me about physical calculators is the lack of a cursor. I wish there was a d-pad with a cursor for editing things, and a backspace button because I always make accidental presses in a calculator


hazemalhalabi
2020-4-16 18:52:11

I know some calculators come with this feature but I wish it were universal


soegaard2
2020-4-16 18:53:52

Modern calculators have d-pads: https://www.youtube.com/watch?v=cAAUS6JB-YM


sorawee
2020-4-16 18:55:51

I think the reason RPN is more popular is that it can evaluate your inputs right away. If you use PN, you potentially need to keep an arbitrarily long “context” first.


sorawee
2020-4-16 18:56:40

E.g., for 1 2 + 4 *, after you enter 1 2 +, it can simplify that to 3 immediately.


sorawee
2020-4-16 18:57:52

But if you use PN, then for * + 1 2 4, you need to remember * first. Simplify + 1 2 to 3. And then evaluate * 3 4 to 12.


slack1
2020-4-16 18:58:00

ah I see


slack1
2020-4-16 18:58:10

RPN it is


sorawee
2020-4-16 18:58:46

Well, this is talking from the perspective of implementing it quick and easy


sorawee
2020-4-16 18:59:03

I do think that PN is much nicer from users’ perspective


slack1
2020-4-16 19:02:41

How come?


sorawee
2020-4-16 19:05:42

Basically because it’s verb then noun, rather than noun then verb. I’m more familiar with the former.


slack1
2020-4-16 19:06:23

ah


slack1
2020-4-16 19:06:42

I’m leaning more towards RPN because the user may wish to push values to the stack


slack1
2020-4-16 19:06:45

without being sure what function to run on it yet


sorawee
2020-4-16 19:07:21

Yeah, that’s a legitimate reason to lean toward RPN.


wanpeebaw
2020-4-17 04:19:11

There is a language called Factor. Seems like a reverse version of Racket. https://en.wikipedia.org/wiki/Factor_(programming_language)

They call this paradigm concatenative language. One interesting property is that they don’t have named variable in their code. https://concatenative.org/wiki/view/Concatenative%20language


samdphillips
2020-4-17 04:42:14

Factor is/was interesting. It was more of an exploratory system. The creator Slava Pestov works on Swift now IIRC.


samdphillips
2020-4-17 04:44:02

> exploratory system … By this I mean it was like Squeak/Pharo/Self, but more forthy


wanpeebaw
2020-4-17 05:44:04

Ah, you are correct. He is now working on Swift. But Factor is still under development. And they’ve done a lot to make the system performance pretty good, it is still fun to watch Factor tech talk @ Google 2008. https://factorcode.org/slava/\|https://factorcode.org/slava/