HP50g small tips and trick
|
06-14-2018, 05:30 AM
Post: #21
|
|||
|
|||
RE: HP50g small tips and trick
(06-13-2018 08:33 PM)Vtile Wrote: Advanced user manual did have a note how to get the right keynumber. You can extract it with this simple UserRPL program: <<DO UNTIL KEY END>> I prefer << 0 WAIT >> (06-13-2018 09:34 PM)Carsen Wrote: ... the 50g will not let me use the USER mode when programming. Sure it will. I use User mode key assignments while programming all the time (most especially SWAP, DROP, and DUP, which the 48 series has as built-in programmable keys, but the 50g amazingly doesn't). Please describe what you wanted to happen, how you tried to do it, and what happened instead. <0|ɸ|0> -Joe- |
|||
06-14-2018, 06:28 AM
Post: #22
|
|||
|
|||
RE: HP50g small tips and trick
I wanted the PRG menu on the SYMB key because I wanted to access the PRG menu with 1 keystroke. So I entered << 22.01 MENU >> and 44.1. Then I pressed ASN. Next, I typed [Orange Shift] [ << >> ] to start a UserRPL program. Then I pressed [ White Shift ] [Alpha ] [ SYMB ] and the PRG soft menu did not appear. Nothing happened.
I also did the same process with swap. I entered << SWAP >> and 44.1. Then I pressed ASN. Next, I pressed [Orange Shift ] [ << >> ] to start a UserRPL program. Then I pressed [White Shift ] [Alpha ] [ SYMB ]. Nothing happened. The SWAP command was not put into the program. |
|||
06-14-2018, 07:17 AM
(This post was last modified: 06-14-2018 07:33 AM by C.Ret.)
Post: #23
|
|||
|
|||
RE: HP50g small tips and trick
(02-20-2017 09:21 PM)ttw Wrote: I can be a little faster by just leaving the remainders on the stack then using DEPTH and ->LIST to pick up the result […] A few years ago, I have used the same trick to arrange multiple results into a single list on an HP-28S. I have not try it on an HP-50g; but it must work as well as on HP-28S. No empty stack was required. The trick was to memorize the initial stack depth into a local variable to adjust size when creating the result list. Code: 6: . Alternatively, a shorter version Code: « DEPTH 2 - → p d |
|||
06-14-2018, 12:08 PM
(This post was last modified: 06-14-2018 07:28 PM by rprosperi.)
Post: #24
|
|||
|
|||
RE: HP50g small tips and trick
(06-14-2018 06:28 AM)Carsen Wrote: I wanted the PRG menu on the SYMB key because I wanted to access the PRG menu with 1 keystroke. So I entered << 22.01 MENU >> and 44.1. Then I pressed ASN. Next, I typed [Orange Shift] [ << >> ] to start a UserRPL program. Then I pressed [ White Shift ] [Alpha ] [ SYMB ] and the PRG soft menu did not appear. Nothing happened. Don't enter Alpha mode, just press the keys you have reassigned and the new function will be inserted (or EVAL'd in the case of a menu, I believe). Edit: yeah, anemic and almost useless reply. I've had Joe's assignments in use for so long I forget they're not default.... #facepalm# --Bob Prosperi |
|||
06-14-2018, 01:09 PM
Post: #25
|
|||
|
|||
RE: HP50g small tips and trick
(06-14-2018 06:28 AM)Carsen Wrote: I wanted the PRG menu on the SYMB key because I wanted to access the PRG menu with 1 keystroke. So I entered << 22.01 MENU >> and 44.1. Then I pressed ASN. Next, I typed [Orange Shift] [ << >> ] to start a UserRPL program. Then I pressed [ White Shift ] [Alpha ] [ SYMB ] and the PRG soft menu did not appear. Nothing happened. Key assignments which are single objects (e.g. SWAP by itself, not << SWAP >> or { SWAP } or the like) will type their name into a program when you're in program mode. But if you want a key assignment to be *executed* (e.g. << 22 MENU >> or the like) then you have to append the System RPL command "TakeOver" to its beginning, conceptually like this pseudo-RPL-code: :: TakeOver :: << 22 MENU >> ; ; When THAT is assigned to a key, it'll execute properly even in program mode. Those who are not comfortable with System RPL can use the ->TO? command in the Keyman+ library (highly recommended) to instantly prepend a TakeOver to any object. (06-14-2018 06:28 AM)Carsen Wrote: I also did the same process with swap. I entered << SWAP >> and 44.1. Then I pressed ASN. Next, I pressed [Orange Shift ] [ << >> ] to start a UserRPL program. Then I pressed [White Shift ] [Alpha ] [ SYMB ]. Nothing happened. The SWAP command was not put into the program. Instead of << SWAP >>, assign just SWAP by itself to the key. One way to get a naked SWAP is { SWAP } 1 GET. On my 50g's, I have SWAP assigned to LS+right, DROP assigned to LS+backspace, and DUP assigned to LS+ENTER, because those correspond exactly to the 48's built-in assignments. (I assume every 48 user knows that shift+ENTER types a DUP into programs, even though it's not labeled on the keyboard). <0|ɸ|0> -Joe- |
|||
06-14-2018, 02:27 PM
Post: #26
|
|||
|
|||
RE: HP50g small tips and trick
(06-14-2018 01:09 PM)Joe Horn Wrote: Those who are not comfortable with System RPL can use the ->TO? command in the Keyman+ library (highly recommended) to instantly prepend a TakeOver to any object. If you want to try out this concept without having to install Keyman+ first, the following program (for a 50g) will do the same thing that Joe describes (prepending a TakeOver to a program): Code: \<< For the curious, the string in the above program is converted to a SysRPL object that is comprised of the following: Code: :: That SysRPL program is then executed with EVAL. |
|||
06-14-2018, 09:30 PM
(This post was last modified: 06-14-2018 09:35 PM by Vtile.)
Post: #27
|
|||
|
|||
RE: HP50g small tips and trick
(06-13-2018 09:34 PM)Carsen Wrote:I have found that the tag is useful when using the calculator for "what if" calculations without paper and pen. Then you can put a short tag to ie. result or constant at the top of the stack where you scroll and pick them for next iteration.(06-13-2018 08:33 PM)Vtile Wrote: Another tip or a trick. If you do not use UserKeys for anything (yet) assign a OBJ->, ->TAG and ->ARRY to F4, F5 and F6 keys on user layer. The normal place at PRG/type/tag is just too deep to be handy. On the otherhand I do not use USER layer as main layer and only for these shorthands.. I have my solve routine from first post assigned to dot key and I have custom physical nameplates lacquered to device.. Handy in my mind. I used to have F4..6 used as described, but now I have only OBJ in F3 and a short chooselist (with automatic last selection memory) in F6 for a few most common conversions ie. arry, tag, R>I etc. |
|||
06-15-2018, 08:36 AM
Post: #28
|
|||
|
|||
RE: HP50g small tips and trick
(06-14-2018 12:08 PM)rprosperi Wrote: Edit: yeah, anemic and almost useless reply. I've had Joe's assignments in use for so long I forget they're not default.... #facepalm# LOL. That makes sense. I was completely confused about what you were saying. I get it now. Thanks Joe Horn. It makes complete sense. This makes the HP 50g even cooler! Now I got to rewrite a few of my key assignments DavidM. Thanks for the SysRPL code. This definitely encourages me to learn SysRPL, especially after I just learned most of UserRPL. Vtile. That makes sense now. You are using the HP 50g as a scratchpad and the ->TAG helps label numbers. |
|||
06-15-2018, 02:15 PM
(This post was last modified: 06-15-2018 02:26 PM by Joe Horn.)
Post: #29
|
|||
|
|||
RE: HP50g small tips and trick
(06-14-2018 02:27 PM)DavidM Wrote: If you want to try out this concept without having to install Keyman+ first, the following program (for a 50g) will do the same thing that Joe describes (prepending a TakeOver to a program): ... Here's another version with the following benefits: (1) Shorter. (2) If the input is not a program, it turns it into one instead of bombing out. Example: Input: object Output: :: TakeOver object ; Instead of: Error: Bad Argument Type (3) If the input is a program, it inserts TakeOver into the beginning of that program instead of embedding the whole thing inside a new program. Example: Input: :: objects ; Output: :: TakeOver objects ; Instead of: :: TakeOver :: objects ; ; Code: \<< The above works by creating & running the following System RPL program (which I call 'TAKOV'): Code: :: <0|ɸ|0> -Joe- |
|||
06-15-2018, 03:20 PM
Post: #30
|
|||
|
|||
RE: HP50g small tips and trick
Full-Screen Edit Without Losing Your Preferred Header Size
If you prefer normally having a HEADER size of 2 or 1, but would like to use the entire screen while editing programs, the Advanced User's Reference Manual suggests the following. Just store these two programs in the HOME directory, and your 50g will automatically flip into full-screen mode while editing, and automatically restore the previous header size when editing is done. You must use the program names shown below or it won't work. The names mean "Start Editor" and "Exit Editor". This whole idea can be done in User RPL, but that causes a delay both before and after editing which is annoying. The System RPL programs below run so fast you'll forget they're there. 'STARTED' BYTES: 25.0 #31DAh Code: :: 'EXITED' BYTES: 22.5 #2BF4h Code: :: This leaves a variable called 'Hdr in your hidden directory, but it only uses 12.5 bytes total. Purging it can be added to the EXITED program, but that slows it down a tad, which detracts from the experience. <0|ɸ|0> -Joe- |
|||
06-16-2018, 08:40 AM
Post: #31
|
|||
|
|||
RE: HP50g small tips and trick
(06-15-2018 03:20 PM)Joe Horn Wrote: Full-Screen Edit Without Losing Your Preferred Header Size Wow! I gotta program this right away. This is really cool. |
|||
06-16-2018, 06:15 PM
Post: #32
|
|||
|
|||
RE: HP50g small tips and trick
Do you have lots of programs in HOME? Do you get tired of pressing NXT looking for them? Here's a simple routine called 'GOTO' that solves that problem. Just type the name of the desired program, then type GOTO, and the menu will instantly jump to the page containing your program, WITHOUT changing the order of your variables, which is important if your program is adjacent to related programs in the VARS list.
Example: I have a zillion programs in HOME. Somewhere buried in there is a program called 'FOO' and a few other programs related to it that I created around the same time... but pressing NXT NXT NXT to find them takes forever. So instead I just type 'FOO' GOTO. FOO and all its related programs appear on the menu keys in their proper VARS positions. Note: GOTO works not just in HOME, but in any directory. I only use it in HOME, though, since that's the only directory whose size has grown out of control. 'GOTO' BYTES: 42.5 #BDDFh Code: << VARS SWAP POS 5. + 6. / IP 1. % 2. + TMENU >> Please don't suggest that a better solution is to keep HOME tidy. HA HA HA! Ain't gonna happen. What child keeps their sandbox TIDY??? I mean, come on now, get real. <0|ɸ|0> -Joe- |
|||
06-16-2018, 07:15 PM
Post: #33
|
|||
|
|||
RE: HP50g small tips and trick
houskeeping and use of variables (especially when they change order) is pretty cool
Wikis are great, Contribute :) |
|||
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. |
|||
06-17-2018, 07:59 AM
(This post was last modified: 06-17-2018 08:03 AM by grsbanks.)
Post: #35
|
|||
|
|||
RE: HP50g small tips and trick
(06-16-2018 09:26 PM)DavidM Wrote: Simple but effective. For those interested, the SysRPL listing of this is: Code: :: "NULL::" creates an empty program on the stack (":: ;", a bit like the UserRPL "<< >>") "' xORDER" places the ID of the UserRPL command "ORDER" on the stack, then: ">HCOMP" adds it to the empty program. leaving us with ":: xORDER ;" on the bottom of the stack. ">R" pushes that to the run stream so that ":: xORDER ;" is run immediately after the SysRPL program has finished and before returning control to the user. Ingenious |
|||
06-17-2018, 02:29 PM
Post: #36
|
|||
|
|||
RE: HP50g small tips and trick
(06-17-2018 07:59 AM)grsbanks Wrote: For those interested, the SysRPL listing of this is: Very nice description! Thanks for adding the explanation. I'd add one more thing that is important but subtle: the ":: xORDER ;" program is created in such a way that it is guaranteed to be in TEMPOB (temporary memory). This is important to make sure that the address pushed onto the return stack isn't part of the running program. |
|||
06-17-2018, 07:01 PM
Post: #37
|
|||
|
|||
RE: HP50g small tips and trick | |||
06-23-2018, 03:15 PM
(This post was last modified: 06-23-2018 03:17 PM by pier4r.)
Post: #38
|
|||
|
|||
RE: HP50g small tips and trick
Checking if the execution went in a loop.
If the 50g is busy executing and one has an estimate about how long the execution should last, one can check if the execution went wrong comparing the current time with the time shown on the calculator. For example I expect that the current execution would take around 2.5 days. The 50g shows: "21:51 18 June"; while now it is "17:13 23 June" (The execution should have ended on the 21st/22nd of June). Therefore likely the program is looping due to a bug. This of course can be valid also if the execution lasts 10+ minutes while one knows it should take less. This concept that can be used on all the devices where the time is frozen if they are busy computing. Wikis are great, Contribute :) |
|||
06-23-2018, 04:26 PM
Post: #39
|
|||
|
|||
RE: HP50g small tips and trick
(06-23-2018 03:15 PM)pier4r Wrote: Checking if the execution went in a loop. When you have no idea at all how long a program may run, it's usually best to include a counter to track the number of iterations and when it exceeds some threshold, exit with a diagnostic message, e.g. "Exceeded 10,000 iterations". Not all existing programs easily lend themselves to inserting such a counter and test after the fact, but I was taught (long ago) that if you can't track the iterations, the program probably is not written correctly, or at least not optimally. How many iterations to allow is hard to generalize about, as it obviously depends on the nature of your algorithm and data, but one usually has a sense for what should happen. And if not, just insert some number and when it errors out, you can examine the variables to look for convergence, or intermediate results, or whatever you are expecting. --Bob Prosperi |
|||
06-23-2018, 04:50 PM
Post: #40
|
|||
|
|||
RE: HP50g small tips and trick
Not clear to me why this snippet does not work on an HP48.
The 'N near the end causes a syntax error. Is there some subtle difference how the 48 handles recalling the address of a local variable? Tnx, TC (02-20-2017 09:21 PM)ttw Wrote: I needed an algorithm to get the digits of an integer in any base. This was as fast as I could do easily. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)