RPN stack I/O from PPL - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: RPN stack I/O from PPL (/thread-10746.html) |
RPN stack I/O from PPL - Stevetuc - 05-16-2018 06:15 AM Here is a workaround to allow reading and writing back to multiple stack locations from PPL It uses the fact that a key definition returns a string to the command line without quotes. So RETURN "stack1 stack2 stack3 stack4" will place those vars onto the lowest 4 stack levels on pressing <ENTER> In the code below , global vars are created to hold the stack values. Ans(1) to Ans(4) are used to pop 4 values from the stack. a sample routine then takes the factorial of the stack values. on pressing SHIFT User 0, stack4 stack3 stack2 stack1 is placed on the command line, and <ENTER> pushes them onto stack. try this: Home screen RPN mode place on stack: 2 <ENTER> 4 <ENTER> 6 <ENTER> 8 <ENTER> Shift User 0 stack4 stack3 stack2 stack1 is returned <ENTER> 2 24 720 40320 is returned to the stack Code:
|