Skip to content

Comment on Try Hyparent

Comments

"+ 41 1" more closely resembeles straight-up non-reverse Polish notation. Its cool property is that it has unambiguous grouping without parentheses.

Reverse Polish notation's even cooler property is that, in addition to the unambiguity, it can easily be evaluated from left to right with a stack: If you see a operand, push it onto the stack. If you see an operator, pop two operands off the stack, compute, and push the result onto the stack. By the end you'll have a one-element stack with your result.

Really what we're seeing here, though, is a language without infix operators: all functions are of the form "<name> <operand1> <operand2>…", but grouping still works as expected.

http://en.wikipedia.org/wiki/Polish_notation

http://en.wikipedia.org/wiki/Reverse_Polish_notation

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.