Post Reply 
DB48x/DB50x implementation of NDUPN & HEAD
11-29-2024, 11:15 AM (This post was last modified: 11-29-2024 12:57 PM by n1msr.)
Post: #1
DB48x/DB50x implementation of NDUPN & HEAD
1. Possible correction required to NDUPN...
2. Behavior of HEAD

DUPN duplicates n objects on the stack, i.e. Level 2 to Level n+1 of the stack contain objects, and all these n objects are duplicated once. n is set on Level 1 of the stack to run DUPN.

NDUPN makes n duplicates of the object on Level 2 of the stack. You need only two objects on the stack to run NDUPN. Level 2 is the object and Level 1 is n, the number of duplicates (copies) of the Level 2 object you want.

In trying one of the HHC programming contest winners from 2011, I came across this apparent error with the NDUPN function on DB50X running on my DM32. I find it a bit easier to use the Windows simulator (on Fedora Linux) when testing, so I went to that. It exhibits the same behavior. I checked the HP 50g AUR and it looks like NDUPN on the DB48X/50X is doing the same thing as DUPN, which is not correct. (I have checked NDUPN on my HP 50g also.)

2. The behavior of HEAD seems to be incorrect. It should get the first element of an object like a string or list. For example "ABCD" HEAD -> "A".
However, I get
"Head error":
Bad argument type


On the calculator I am running the latest released version of DB50X (0.8.6) The simulator I am using is running the same version (v0.8.6) of DB48X. The behaviors above are the same on the DM32 and on the simulator.


(PS: I don't think I chose a very good set or RPL programs with the HHC 2011 contest submissions to test on my DB50X. Many use RPL function(s) that have yet to be implemented on the DB48X (e.g. R->I, SREPL ).
Find all posts by this user
Quote this message in a reply
11-29-2024, 06:26 PM (This post was last modified: 11-29-2024 06:27 PM by c3d.)
Post: #2
RE: DB48x/DB50x implementation of NDUPN & HEAD
(11-29-2024 11:15 AM)n1msr Wrote:  1. Possible correction required to NDUPN...
2. Behavior of HEAD

DUPN duplicates n objects on the stack, i.e. Level 2 to Level n+1 of the stack contain objects, and all these n objects are duplicated once. n is set on Level 1 of the stack to run DUPN.

NDUPN makes n duplicates of the object on Level 2 of the stack. You need only two objects on the stack to run NDUPN. Level 2 is the object and Level 1 is n, the number of duplicates (copies) of the Level 2 object you want.
Indeed, I implemented NDUPN as DUPN leaving N on stack and not as what it actually does. Ooops. To my defense, it's not very logically named ;-)

Will be fixed in 0.8.7.

Quote:In trying one of the HHC programming contest winners from 2011, I came across this apparent error with the NDUPN function on DB50X running on my DM32. I find it a bit easier to use the Windows simulator (on Fedora Linux) when testing, so I went to that. It exhibits the same behavior. I checked the HP 50g AUR and it looks like NDUPN on the DB48X/50X is doing the same thing as DUPN, which is not correct. (I have checked NDUPN on my HP 50g also.)

2. The behavior of HEAD seems to be incorrect. It should get the first element of an object like a string or list. For example "ABCD" HEAD -> "A".
However, I get
"Head error":
Bad argument type

Indeed, HEAD and TAIL are not implemented on text. This will be fixed in 0.8.7.

Quote:On the calculator I am running the latest released version of DB50X (0.8.6) The simulator I am using is running the same version (v0.8.6) of DB48X. The behaviors above are the same on the DM32 and on the simulator.


(PS: I don't think I chose a very good set or RPL programs with the HHC 2011 contest submissions to test on my DB50X. Many use RPL function(s) that have yet to be implemented on the DB48X (e.g. R->I, SREPL ).

On the contrary, these are good examples of source-compatibility tests. Keep them coming!

DB48X,HP,me
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: jeanwilson, 2 Guest(s)