12-20-2019, 02:52 PM
No doubt there must be more interesting ways to spend a couple of hours, but if you'd fancy this subject here's the mini-challenge description:
#1:- Splice: Given two equal-sized blocks of data registers, {R01-Rn} and {Rn+1, R2n} your mission is to write a data splicing routine that has one register from each block stored consecutively, i.e. {R1, Rn+1, R2, Rn+2,... Rn, R2n}.
#2:- Split.- Separate the interlaced 2n-block of registers into two n-Regs blocks, so the routine does the inverse task.
In both cases the resulting block occupies the same memory area, i.e. from R01 to R2n.
a) Expert Level: it's ok to use an auxiliary data registers area for scratch.
b) Master Level: do it in-place using swapping actions.
Rumor has it that the master level fits in the page' margins of this post... ;-)
BTW solutions in RPL and BASIC are kinda trivial, but I predict this is going to make us all hate RPN for a while...
Disclaimer: I haven't done it yet, so we're all in equal condition here (kinda how I like it).
Cheers,
ÁM
#1:- Splice: Given two equal-sized blocks of data registers, {R01-Rn} and {Rn+1, R2n} your mission is to write a data splicing routine that has one register from each block stored consecutively, i.e. {R1, Rn+1, R2, Rn+2,... Rn, R2n}.
#2:- Split.- Separate the interlaced 2n-block of registers into two n-Regs blocks, so the routine does the inverse task.
In both cases the resulting block occupies the same memory area, i.e. from R01 to R2n.
- Platform: HP-41CX or lesser.
- Parameter entry for both routines: block size "n" in register X.
- Stack is obviously available for pointers and scratch.
- R00 is free to use, all others are for data.
a) Expert Level: it's ok to use an auxiliary data registers area for scratch.
b) Master Level: do it in-place using swapping actions.
Rumor has it that the master level fits in the page' margins of this post... ;-)
BTW solutions in RPL and BASIC are kinda trivial, but I predict this is going to make us all hate RPN for a while...
Disclaimer: I haven't done it yet, so we're all in equal condition here (kinda how I like it).
Cheers,
ÁM