Reverse Polish Notation Calculator


I just wrote a Reverse Polish Notation calculator. It’s beautiful. Extending a Forth compiler with new words must be a dream.

The ease of parsing functions of higher arity is astonishing. As long as you know how many arguments a function expects, you can feed them in trivially by popping them off a stack. Variadic functions can be given lists of arguments since the calculator expects a fixed number of arguments for each function.

I wonder how RPN handles partial function application. Associativity seems to just become a cyclic shift, at least at first glance. I’m going to figure out distributivity and commutativity later today.

The lack of ambiguity and the corresponding lack of parentheses is nice.

I can see why some people are addicted to using RPN calculators.

Related Posts

How to Disable Disqus Ads on your Blog

Derivation of Reservoir Sampling

Fun with Python Iterators: Linked Lists Made Easy

Notes for November 11, 2018

Underrated Vim Option: undofile and undodir

Hot Take on Solo Travel: Starve

Alan Perlis

Book Notes: The Map of My Life by Goro Shimura

Prague

Way to remember the definition of local finiteness