HP Forums

Full Version: (50g) Mirror the stack
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, late yesterday (or yearly today) I were toying with the 50g before going to sleep, well I entered long series of the number to the stack just to notice I entered them in reverse order. Then I tried to find a "stack mirror" function or script, without success so I created this UserRPL software to do it. I'm sure there is more sophisticated method of doing it, but here is one solution.

Provided as is, in the hope it is usefull. Public domain.

Code:

<< DEPTH Y → X Y 
<< 2 'Y' STO
2 X START
Y PICK
2 Y + 'Y' STO
NEXT
X →LIST
X ROLLD
X 1 - DROPN
OBJ→ DROP
>>
>>

- Vtile
An efficient way on the 50g:

Enter number of elements you want to mirror & execute:

Code:

::
CKN
reversym
UNCOERCE
;

Edited following rprosperi, posting #7.
What are these commands I can not find them from AUR?
The Hp 50g supports two command sets: user RPL and system RPL.
The second has more commands and less checks making it faster than the first but also more prone to errors and possibly hard locks.
The second is also not documented in the user guide so you'll have the surf the wild wild web to get info.
You can do a lot already with user RPL, so wisely choose how you want to use your free time...
(03-19-2016 04:38 PM)Tugdual Wrote: [ -> ]The Hp 50g supports two command sets: user RPL and system RPL.
The second has more commands and less checks making it faster than the first but also more prone to errors and possibly hard locks.
The second is also not documented in the user guide so you'll have the surf the wild wild web to get info.
You can do a lot already with user RPL, so wisely choose how you want to use your free time...
That what I was suspecting, but I were on the (wrong) impression that AUR constains also SysRPL commands. I think I stay away from it. Smile UserRPL mirror does mirror 1000 stack entries in about 6½ seconds and 2000 entries before I can get new cup of coffee, so there is no need for me for more speed. Edit.. It seems calculator starts to "fail" above 1k high stack, not bad.

Anyway thx, Gerald H. for sysRPL version.
You might also consider entering the values in the right order.
This is even faster than swapping the stack...
(03-19-2016 02:50 PM)Gerald H Wrote: [ -> ]An efficient way on the 50g:

Enter number of elements you want to mirror & execute:

Code:

::
CKN
reversym
UNCOERCE
::

A minor nit, but the closing "::" should be simply ";"
But a really good example of the power and elegance of SysRPL, thanks Gerald.
(03-19-2016 05:08 PM)Tugdual Wrote: [ -> ]You might also consider entering the values in the right order.
This is even faster than swapping the stack...
Naturally, the 50g is missing this kind of command though. "Pick a block" would be even better command for scratch book use (half braindead mode Big Grin), maybe I should propose it for the newRPL crew.
(03-19-2016 04:54 PM)Vtile Wrote: [ -> ]
(03-19-2016 04:38 PM)Tugdual Wrote: [ -> ]The Hp 50g supports two command sets: user RPL and system RPL.
The second has more commands and less checks making it faster than the first but also more prone to errors and possibly hard locks.
The second is also not documented in the user guide so you'll have the surf the wild wild web to get info.
You can do a lot already with user RPL, so wisely choose how you want to use your free time...
That what I was suspecting, but I were on the (wrong) impression that AUR constains also SysRPL commands. I think I stay away from it. Smile UserRPL mirror does mirror 1000 stack entries in about 6½ seconds and 2000 entries before I can get new cup of coffee, so there is no need for me for more speed. Edit.. It seems calculator starts to "fail" above 1k high stack, not bad.

Anyway thx, Gerald H. for sysRPL version.
On your free time you might check this page: http://www.hpcalc.org/details.php?id=5142
This is a pretty good introduction to sysRPL.
(03-19-2016 05:53 PM)Vtile Wrote: [ -> ]
(03-19-2016 05:08 PM)Tugdual Wrote: [ -> ]You might also consider entering the values in the right order.
This is even faster than swapping the stack...
Naturally, the 50g is missing this kind of command though. "Pick a block" would be even better command for scratch book use (half braindead mode Big Grin), maybe I should propose it for the newRPL crew.

How about this way?
Code:

<< DEPTH →LIST REVLIST OBJ→ DROP >>
Big Grin too simple. I see it were the REVlist that I were searching.. Half an hour weren't enough to come up with that from AUR.

Rev .. Reverse naturally, dang.
Reference URL's