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 » ...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. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)