Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, RPN is essentially what you'd get as output if you compiled LISP using a compiler. Claiming RPN is as easy to deal with as LISP would be utterly absurd, and no one genuinely believes that.


Well, RPN with parentheses, as a layer of syntax, would be easy to deal with. That's what Lisp backwards would be.

  ((a b +) (a b) add defun)

  (((list pop) print) list while)
It helps me to read it in Japanese:

"A to B wo tasu, A to B no paramēta no aru, 'add' to iu kansuu wo 'defun' shite."

"lisuto wo 'pop' shite, sore wo insatsu shite, lisuto ga kara de nai aida ni"

Interesting things happen. When we think about how 'add' is called, we follow it from right to left, contrary to the direction of speech of the Japanese sentence. The function add is called, the (a b) parameters receive argument values and the (a b +) is evaluated.

However, the chained application expressed by nesting, which people complain about being backwards (so they need to invent piping/threading macros to go left to right) now reads left to right! We do have to evaluate the while condition first, but then the pop and print to left to right.


Yeah, the Japanese incorrectly put verbs at the end of the sentence! Just like Yoda does. Asian he must be. Incorrect they all are.

But seriously, yeah computers are naturally 'Stack Machines' [almost] always, where they need the arguments pushed onto a stack before the 'verb' is executed.


Even if we don't think about stacks, but just the raw data dependency: before we can perform an operation, we need to determine its operands.

So if we translate that sequence to language, stating the operands before the operation does follow the non-negotiable evaluation data flow.


That's why we have interpreters and compilers: So we can make code easier to read. FORTRAN was originally invented as a way to let humans think in terms of parenthetical groupings for math and functions, specifically to _avoid_ reasoning in an RPN way.


What programming systems used RPN prior to 1957?


Doing ASM ~ "RPN reasoning".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: