Post Reply 
HP50g small tips and trick
06-16-2018, 09:26 PM (This post was last modified: 06-17-2018 01:56 PM by DavidM.)
Post: #34
RE: HP50g small tips and trick
Following the same theme of housekeeping utilities, many are familiar with the ORDER command which can be used to reorder/move global variables to the front of a given directory. You simply provide it with either a list of IDs or a single ID which will then be placed at the beginning of the current directory.

If you have several objects/programs that you like to keep at the beginning of a directory, it is tempting to create a program such as:

Code:
« { ID1 ID2 ID3 ... } ORDER »
(edit: first posting didn't have the list brackets)

...which you could then use to conveniently move your favorites to the front of the current directory. This works as expected, with one exception: the above program object can't cause itself to be moved. If your reorder program would end up moving itself, the program generates an "Invalid Syntax" error. You can trap that error, but reordering stops mid-stream if you do. The ORDER command never completes in that situation.

If you run into this, the following can be used in a UserRPL program as a replacement for ORDER:

Code:
"D9D20DF55079E600F8E36C250F9F60B2130" H→ EVAL

To work properly, this code cannot reside within a subroutine or structural statement (IF-THEN, FOR, DO, WHILE, CASE, etc. -- anything that requires an END, NEXT/STEP, or embedded »). The typical use of this sequence is to simply place it as the last steps before the final "»" of the program object.

This works by creating a temporary program that only has the ORDER command in it, which is then inserted into the runstream for processing immediately following the current RPL sequence. When that ORDER is executed, the program object has already completed, which is why it can now be safely moved. This is also why the commands can't be embedded in a subroutine or structure; they simply execute ORDER at the conclusion of whatever sequence is currently running. If the current sequence is nested in any way, the ORDER command will be attempted prior to the conclusion of the program. This would result in the same error as before.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP50g small tips and trick - Vtile - 12-13-2016, 11:58 PM
RE: HP50g small tips and trick - tdh79 - 12-19-2016, 11:27 AM
RE: HP50g small tips and trick - franz.b - 06-13-2018, 10:55 AM
RE: HP50g small tips and trick - ttw - 12-19-2016, 07:38 PM
RE: HP50g small tips and trick - Carsen - 01-02-2017, 05:21 AM
RE: HP50g small tips and trick - Vtile - 01-03-2017, 08:55 AM
RE: HP50g small tips and trick - grsbanks - 01-11-2017, 01:29 PM
RE: HP50g small tips and trick - Joe Horn - 01-11-2017, 06:32 PM
RE: HP50g small tips and trick - RichieHH - 06-16-2022, 08:43 PM
RE: HP50g small tips and trick - Vtile - 01-11-2017, 06:05 PM
RE: HP50g small tips and trick - grsbanks - 01-11-2017, 06:56 PM
RE: HP50g small tips and trick - DavidM - 01-11-2017, 09:07 PM
RE: HP50g small tips and trick - Vtile - 01-11-2017, 11:41 PM
RE: HP50g small tips and trick - grsbanks - 01-12-2017, 09:19 AM
RE: HP50g small tips and trick - Vtile - 01-17-2017, 01:30 PM
RE: HP50g small tips and trick - ttw - 02-06-2017, 07:47 PM
RE: HP50g small tips and trick - ttw - 02-20-2017, 09:21 PM
RE: HP50g small tips and trick - C.Ret - 06-14-2018, 07:17 AM
RE: HP50g small tips and trick - TomC - 06-23-2018, 04:50 PM
RE: HP50g small tips and trick - Juan14 - 07-04-2018, 02:55 PM
RE: HP50g small tips and trick - Joe Horn - 07-04-2018, 04:52 PM
RE: HP50g small tips and trick - DavidM - 07-04-2018, 05:39 PM
RE: HP50g small tips and trick - Carsen - 06-13-2018, 08:12 AM
RE: HP50g small tips and trick - Vtile - 06-13-2018, 08:33 PM
RE: HP50g small tips and trick - Carsen - 06-13-2018, 09:34 PM
RE: HP50g small tips and trick - Joe Horn - 06-14-2018, 05:30 AM
RE: HP50g small tips and trick - Vtile - 06-14-2018, 09:30 PM
RE: HP50g small tips and trick - Carsen - 06-14-2018, 06:28 AM
RE: HP50g small tips and trick - rprosperi - 06-14-2018, 12:08 PM
RE: HP50g small tips and trick - Joe Horn - 06-14-2018, 01:09 PM
RE: HP50g small tips and trick - DavidM - 06-14-2018, 02:27 PM
RE: HP50g small tips and trick - Joe Horn - 06-15-2018, 02:15 PM
RE: HP50g small tips and trick - Carsen - 06-15-2018, 08:36 AM
RE: HP50g small tips and trick - Joe Horn - 06-15-2018, 03:20 PM
RE: HP50g small tips and trick - Carsen - 06-16-2018, 08:40 AM
RE: HP50g small tips and trick - Joe Horn - 06-16-2018, 06:15 PM
RE: HP50g small tips and trick - pier4r - 06-16-2018, 07:15 PM
RE: HP50g small tips and trick - DavidM - 06-16-2018 09:26 PM
RE: HP50g small tips and trick - grsbanks - 06-17-2018, 07:59 AM
RE: HP50g small tips and trick - DavidM - 06-17-2018, 02:29 PM
RE: HP50g small tips and trick - Vtile - 06-17-2018, 07:01 PM
RE: HP50g small tips and trick - pier4r - 06-23-2018, 03:15 PM
RE: HP50g small tips and trick - rprosperi - 06-23-2018, 04:26 PM
RE: HP50g small tips and trick - pier4r - 06-23-2018, 05:43 PM
RE: HP50g small tips and trick - TomC - 06-23-2018, 05:02 PM
RE: HP50g small tips and trick - DavidM - 06-23-2018, 05:35 PM
RE: HP50g small tips and trick - pier4r - 08-08-2018, 09:25 AM
RE: HP50g small tips and trick - pier4r - 08-08-2018, 11:18 AM



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