Post Reply 
[newRPL] interested in RPN mode?
10-18-2019, 10:17 PM
Post: #9
RE: [newRPL] interested in RPN mode?
(10-18-2019 08:54 PM)Claudio L. Wrote:  
(10-18-2019 07:55 PM)rprosperi Wrote:  Would newRPN (w/4-level stack) be only for interactive use, or would normal RPL programming capabilities still apply (it seems they would be extremely hobbled with a 4-stack depth limit)?

Good question, I guess we need to define exactly how this would behave.

The way I see it, I could implement RPN the following way:

* A flag (ok, 2 flags) would determine stack depth: 4-level, 8-level or infinite.
* The execution loop would test the flags, and check after executing each command if the stack has > 4 (or 8) levels and "trim" it, or if it has less it would get the last known "T" value and fill the stack with it to complete the 4/8 levels.
* The UI can be tweaked to make the Enter key behave more like an RPN machine.

This means that internally, existing newRPL commands will make use of the entire memory and infinite stack, but once the command ends, the response will "trim" the stack to 4 levels. For example, if you have a 5 element list and you do OBJ->, you'll get the last 3 elements and the number 5 on the stack (after a "trim" to only 4 values).
But, if you keep the list together, one list (or vector/matrix) takes ONE stack level, also one complex number takes ONE level, not 2 as in the classic RPN machines. So code could make more efficient use of the stack.

Programming would of course be plain RPL, implementing keystroke programming would require a much more detailed reimplementation of commands and UI.
If you are truly nostalgic, just write RPL using [Enter] after each command so it all lines up vertically like in keystroke programs Smile.

In summary, the idea is to have not a completely new calculator called newRPN, but an RPN mode running on the same RPL engine. A couple of flags would allow any user or program to enable/disable RPN mode at will.

As long as the stack is 'trimmed' to 4 levels after processing, it sounds interesting.

And by 'check after executing each command' does this mean each newRPL-native command, or would it include previously-defined newRPL prograns/commands already in the user's path? If the latter, then I suppose one could mix newRPL commands into newRPN commands and programs, so extended-stack manipulation components can be used (Matrices, Lists, etc.) as needed, returning simpler results to be consumed in the newRPN program.

Is that what you're thinking?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [newRPL] interested in RPN mode? - rprosperi - 10-18-2019 10:17 PM



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