Post Reply 
RPN Mini-Challemge: Splice & Split register blocks
12-20-2019, 02:52 PM (This post was last modified: 12-20-2019 03:04 PM by Ángel Martin.)
Post: #1
RPN Mini-Challemge: Splice & Split register blocks
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.

  1. Platform: HP-41CX or lesser.
  2. Parameter entry for both routines: block size "n" in register X.
  3. Stack is obviously available for pointers and scratch.
  4. 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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RPN Mini-Challemge: Splice & Split register blocks - Ángel Martin - 12-20-2019 02:52 PM



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