Post Reply 
NewRPL: RPN with brackets (A * B) + (C / D) => (A B *) (C D /)
04-15-2018, 03:03 PM
Post: #1
NewRPL: RPN with brackets (A * B) + (C / D) => (A B *) (C D /)
Hello, one of the difficulties of reading a program code written in RPL and expressions, written Reverse Polish Notation (RPN) is knowing how to identify the scope of the expressions, that is, from where they begin and end.

One option is to add brackets () and to differentiate the ASCII symbols 28 and 29, use the hexadecimal values 276a 276b ❪❫

(A * B) + (C / D) => (A B *) (C D /) + => ❪A B *❫ ❪C D /❫

[Image: rpn_with_brackets.png]

Good idea?

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
Find all posts by this user
Quote this message in a reply
04-15-2018, 03:23 PM
Post: #2
RE: NewRPL: RPN with brackets (A * B) + (C / D) => (A B *) (C D /)
Seems like a good chunk of extra typing for little return. I don't personally find RPN hard to read, at any rate on the scale of your examples.
Find all posts by this user
Quote this message in a reply
04-15-2018, 04:14 PM
Post: #3
RE: NewRPL: RPN with brackets (A * B) + (C / D) => (A B *) (C D /)
(04-15-2018 03:48 PM)moonbeam Wrote:  Isn't RPN/RPL's raison d'être the very absence of brackets?

I can sort of see brackets as syntactic sugar, but this purpose is better served by comments and pretty-printing.

is a NEW RPL reinvented, easier to use, codify, more powerful, more intuitive, auto-documented =]

pretty-printing in RPL is not possible because the expression has been separated (A B *) (C D /)

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
Find all posts by this user
Quote this message in a reply
04-17-2018, 02:25 AM
Post: #4
RE: NewRPL: RPN with brackets (A * B) + (C / D) => (A B *) (C D /)
the idea of tabulation is a way of grouping and visualizing parts of expressions, the converter has an option [STACK] that performs something similar, please try it.

RPN online converter
http://www.hpmuseum.org/forum/thread-4032.html

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
Find all posts by this user
Quote this message in a reply
04-26-2018, 03:32 PM (This post was last modified: 04-26-2018 04:09 PM by Vtile.)
Post: #5
RE: NewRPL: RPN with brackets (A * B) + (C / D) => (A B *) (C D /)
I solely use expressions like 'A+B*(X-y)' when that sort of thing is needed (even then these days I prefer to compose the algebraic expression in RPL stack) and in program code I do use:

<<
A B C + - <CR>
TemperaryVAR SWAP DUP * / <CR>
>>

The only problem above is that the basic interpreter in the stock 50g will mix it up when you push it to the stack.

I think We should remember that in RPL opposite to RPN we do deal with OBJECTS which can be anything, but the objects are interacted with reverse polish logic.

So:
2(=1 object) A(=1 object) STO (=command)
3(=1 object) B(=1 object) STO (=command)
'A+B' (=1 object, composed from 3 (sub)objects or from 4 (sub)objects if you count the out most container as an object, which I think would be the most correct way)

"..." "STRING" + (object1 + object2)
>>>>
"...STRING"

<<'A' 'B' 'C' {} + + +>> (1 object composed from 7 (sub)objects (+1 obj.))
{'A' 'B' 'C'} (1 object)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)