HP Forums
RPN and decomposing list to stack - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: RPN and decomposing list to stack (/thread-1912.html)



RPN and decomposing list to stack - mcjtom - 08-03-2014 03:56 PM

In RPN, one can combine stacks into a list. Is it possible to decompose a list back into stack?


RE: RPN and decomposing list to stack - Marcus von Cube - 08-07-2014 01:54 PM

On the Prime you can return a list but not decompose it. There is no way to return more than a single object to the stack.


RE: RPN and decomposing list to stack - mcjtom - 08-08-2014 04:22 AM

Thanks. This is probably a naive question, but can't the list be decomposed sequentially somehow then, or the program can only return one object?

I don't even know how to get an element from a list by hand - SUB was the closest command I could find and it returns single-element list (how to get an element from it, I don't know).


RE: RPN and decomposing list to stack - Helge Gabert - 08-08-2014 02:24 PM

You get the element by direct access (e.g., L1(1) returns the first element of L1.)

This should be explained in the manual under "Lists", but maybe it isn't.


RE: RPN and decomposing list to stack - mcjtom - 08-09-2014 10:59 AM

Thanks, Helge!

How would it work with a {list} on stack - would it mean that I have to save it in a global variable first (e.g. L1) to be able to access elements, or somehow decompose the list?

Cheers!


RE: RPN and decomposing list to stack - Helge Gabert - 08-09-2014 02:59 PM

No, in CAS, you can do {1,2,3,4}(3) to retrieve the 3rd element. But in Home, that doesn't work, because of implied multiplication, so there, yes, save it first and then do name().