HP Forums
sysRPL - Last Element of a Composite - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: sysRPL - Last Element of a Composite (/thread-22516.html)



sysRPL - Last Element of a Composite - FLISZT - 10-15-2024 10:42 PM

Hello,

In sysRPL, ^LASTCOMP (2BC006) is said to return the last element of a composite.
For that purpose, this command executes DUPLENCOMP (3627A) then NTHCOMPDROP (35BC3).

Indeed, if I do (i.e.):
Code:
{ 1 2 3 5 7 } 
#3627Ah SYSEVAL          @  DUPLENCOMP
#35BC3h SYSEVAL          @  NTHCOMPDROP
I get 7 which is the expected result.

However, when I do:
Code:
{ 1 2 3 5 7 }
#2BC006h SYSEVAL         @  ^LASTCOMP
the calculator (HP 50G) freezes. (Fortunately, ON + C works without data loss! )

Is an argument missing? What am I doing wrong?

Thank you for any hint.


RE: sysRPL - Last Element of a Composite - DavidM - 10-15-2024 11:03 PM

(10-15-2024 10:42 PM)FLISZT Wrote:  Thank you for any hint.

^LASTCOMP is a FLASHPTR, indicated by the "^" as the first character of the ID. Instead of using SYSEVAL, you will need to use #2BC006h FLASHEVAL.


RE: sysRPL - Last Element of a Composite - FLISZT - 10-15-2024 11:23 PM

(10-15-2024 11:03 PM)DavidM Wrote:  
(10-15-2024 10:42 PM)FLISZT Wrote:  Thank you for any hint.

^LASTCOMP is a FLASHPTR, indicated by the "^" as the first character of the ID. Instead of using SYSEVAL, you will need to use #2BC006h FLASHEVAL.

Thank you very much David! I did learn something.
Smile


RE: sysRPL - Last Element of a Composite - DavidM - 10-16-2024 11:45 AM

You're welcome, Bruno!

SYSEVAL, FLASHEVAL and LIBEVAL all have their specific uses. I've seen many more instances of posts containing SYSEVALs, so it's easy to forget about the others.

When you see a "^" at the beginning of a routine name, it's almost certainly a FLASHPTR which would require FLASHEVAL. Likewise, a "~" would designate a ROMPTR requiring a LIBEVAL construct.

Standard disclaimer applies:

When using any of SYSEVAL, FLASHEVAL or LIBEVAL, be aware that any potential misapplication (including typos or simply incorrect usage) could lead to data loss. Best to try it out on an emulated system first.


RE: sysRPL - Last Element of a Composite - FLISZT - 10-16-2024 11:00 PM

(10-15-2024 11:03 PM)DavidM Wrote:  
(10-15-2024 10:42 PM)FLISZT Wrote:  Thank you for any hint.

^LASTCOMP is a FLASHPTR, indicated by the "^" as the first character of the ID. Instead of using SYSEVAL, you will need to use #2BC006h FLASHEVAL.

^ for pointer as in Pascal AFAIK (I never practiced it).

In sysRPL, it's better not to skip pages, although it's tempting to do so, given their number! Wink

Thanks again David!