Post Reply 
Access RPN stack result in PPL program?
09-05-2014, 01:38 AM (This post was last modified: 09-05-2014 01:40 AM by oldhpfan.)
Post: #2
RE: Access RPN stack result in PPL program?
(09-04-2014 10:26 PM)gbh Wrote:  How do I access the value in the lowest level of the RPN stack (x, level 1) in a PPL program?

The Ans function returns a list of the last pair of operands, rather than the result of the last operation.

Thanks.

So far as I can tell there is no way to access the stack functions like echo from PPL as they seem to be interactive only (it would be nice if you could do something like x:= Echo(1); in a program and it would give you the value from level 1 of the stack, alas it doesn't work).
So unless someone out there knows how to do this the only work around I can think of would be to store the value from the stack into a variable and then use that variable in your program.
e.g.
5 Enter 'D' sto (put 5 on the stack as an example and store in the global variable D you could also create your own variable).
In the program you could square by doing: D:=D*D; or whatever you want to do with it. Remember it's a global variable so be careful as other programs could change the value.
Another option if you have several things on the stack would be to use the list stack function to create a list, store the list in a variable then access the list in your program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Access RPN stack result in PPL program? - oldhpfan - 09-05-2014 01:38 AM



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