Post Reply 
HP 48GX IFT Error: Too Few Arguments
06-24-2021, 12:55 PM (This post was last modified: 06-24-2021 07:06 PM by Giuseppe Donnini.)
Post: #10
RE: HP 48GX IFT Error: Too Few Arguments
Thanks for chiming in, John. That’s exactly what I meant. I wasn’t refering to the outer program which contains the conditional branching structure, but to the elements of that structure themselves, i.e. to the then-sequence and, possibly, the else-sequence. In the case of the RPN command forms, these sequences are indeed represented by stack objects, and they can be of any type. However, since IFT and IFTE evaluate their stack arguments instead of just executing them, list objects can be used as programs.

Note that the RPN forms also allow for more sophisticated programming in yet another respect: since all they care about is the stack, the test-sequence, the then-sequence, and the else-sequence may be placed in separate programs. In contrast, the ordinary non-RPN structures require that everything be contained in the same (outer) program.

(06-23-2021 02:33 PM)John Keith Wrote:  Unfortunately, RPL commands are inconsistent in terms of what procedure-class objects they will accept.

All reliable sources, like the HP-28C Reference Manual (which presented the concepts of RPL to the general public for the first time), Bill Wickes’ Insights series, the HP Journal articles, RPLMAN.DOC, etc., make it abundantly clear that lists and tagged objects are not procedure class objects, but data class objects. Try to evaluate a list on the HP-28C/S!

It is true that the HP-48 added the possibility to make lists behave like procedure-class objects, but only for two very specific reasons, and only on explicit request by EVAL or IFT/IFTE, precisely. These reasons are:

  1. To allow procedures to build new procedures. Otherwise, this essential RPL feature would not be available at the user level, since – for good reasons – there is no \->PRG / PRG\-> pair of commands for building and taking apart compiled program objects, similar to \->LIST and LIST\-> for lists.
     
  2. To have a simple means of changing directories by evaluating path lists.

But for all other purposes, lists are simply data class objects. So, the behavior you describe here

(06-23-2021 02:33 PM)John Keith Wrote:  Neither will accept lists.

is the (well) documented behavior.


(06-23-2021 02:33 PM)John Keith Wrote:  [...] they can also be null-tagged commands [...] The advantage is that lists and null tags execute faster and take less memory than programs.

I would not recommend this practice for the reasons given above. If time and space are critical, the programmer should definitely turn to System RPL or assembly language, instead of writing bad, and potentially unstable, code.

N.B. Since the original poster explicitly referred to the HP-48GX, I want to add that MAP is not an HP-48 command, and that DOLIST can indeed handle tagged objects on the HP-48. As so often, the HP-49G series introduced a problem that never existed on the HP-48 (in this case, by botching up the argument dispatching mechanism).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 48GX IFT Error: Too Few Arguments - MNH - 06-17-2021, 01:46 AM
RE: HP 48GX IFT Error: Too Few Arguments - Giuseppe Donnini - 06-24-2021 12:55 PM



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