HP Prime - RPN stack access from programs?



#12

Been a long time since I posted here. I received my HP Prime a few days ago and generally I am impressed, although I also look forward to the many tweaks and improvements in the firmware we'll likely see in the future, thanks to the dedicated people working on this project. I also wanted to chime in that I agree with those that find the key labels to have poor contrast. I find them quite difficult to read in almost any light! Although my eyesight is not what it used to be, I don't have any issues with my other calculators, like my 15C, 35S or 50g for example. However the keyboard feel and responsiveness of the Prime is fantastic!

While I do like the tremendous programming environment flexibility of my 50g, I also appreciate the easier to read, more "conventional" programming language that the Prime offers, especially since it allows for persistent comments as well. However one bit of frustration has been that I have not been able to figure out how one can access the RPN-mode stack from within a program? Is it possible to read/write values from/to the RPN stack?

The first programs I wanted to write were ones to help with quicker STO/RCL from the stack, mimicking the simplicity of older HP calculators. For example, on my 50g I too found STO and RCL not to be as quick and convenient as, for example, on my 15C, so I created STOX and RCLX programs that reside on the first page of the CUSTOM menu for quick access. When you press STOX, the calculator pauses and waits for a keystroke. It then creates a variable in a special directory with a name corresponding to the numerical key-code of the subsequent key pressed, both unshifted and shifted. STOX then stores the object on level 1 of the stack into that variable. RCLX will recall the object associated with that key-code and push it onto the stack.

My STOX and RCLX programs on the 50g allow me rapid access to over 120 quick "memory locations" and I was hoping to write something similar for the HP Prime (although GETKEY will only allow for unshifted "memory locations", which is still plenty) simply using a list rather than custom variable names, however so far I am stymied by the apparent lack of RPN stack access. I have tried looking in the manuals and have tried Googling, but so far to no avail. Is there an as-yet unpublished way of doing this?

Appreciate any help or suggestions... thanks!

Regards,
Mike Mander


#13

I agree with you. I have written a tremendous amount of programs for the 48/50 series calculators and it would have been nice if transition was as smooth as from the 42S to 48 to the 50. For me to invest that amount of time to re-write in another language doesn't make sense. While I love the idea of the Prime, with the touchscreen, and all the features, it's just not practical for me. And a friend who works at a major HP outlet told me that the 50G price is going to drop, which could mean that it may be stopped.


#14

Quote:
And a friend who works at a major HP outlet told me that the 50G price is going to drop, which could mean that it may be stopped.

While I believe the 50g will be around and available for at least some time to come, I am thinking of picking up a second one just to have as a backup in case they stop selling them.

I really like the Prime, but there's just something about it that's making me feel like it's not as "serious" as the 50g. I think the way the Home and CAS modes are separated and the inconsistencies between the two are some of the reasons I feel this way at the moment, but it may just be psychological. It also feels like RPN is only half implemented (maybe to appease the crowd).

Don't get me wrong. I really do like the Prime a lot. I definitely think there's some room for improvement for the Prime in future firmware versions, and I have confidence that it will improve. However (in my ever so humble opinion), I think the 50g is the last real "serious" engineering geared calculator we'll see, while things are shifted more toward educational applications. I don't necessarily think that's a bad move on HP's part.

-Clayton


#15

So what would you envision this access method to be? Ans(n)? (fairly standard alg type thing) Something else? Should it function when the program is run anywhere in the system? Or only on the home screen? How to distinguish between CAS/HOME?

What seems a fairly simple thing on the surface can actually open a large collection of issues that all need to be thought about before implementing something.

I'd definitely like feedback around this as it is definitely something we'd like to address.

TW


#16

Quote:
So what would you envision this access method to be? Ans(n)? (fairly standard alg type thing) Something else? Should it function when the program is run anywhere in the system? Or only on the home screen? How to distinguish between CAS/HOME?

What seems a fairly simple thing on the surface can actually open a large collection of issues that all need to be thought about before implementing something.

I'd definitely like feedback around this as it is definitely something we'd like to address.

TW


Since we're going there -- what really needs to happen is that HOME/CAS should be merged and not separated. But we don't live in an ideal world, and at this point I imagine it would be impossible to redesign how CAS integrates with the rest of the system.

That said, RPN should be a mode that is usable in both Home and CAS. The system menu should default to a menu dedicated to stack operations. In fact, I have currently have no idea what the menu is for when in the Home screen. I see STO> and that's it -- makes me wonder why it is not just disabled (since STO> is a [Shift][EEX]) and just show the menu when a menu operation is called (e.g. pressing the toolbox key).

The way the HP50G was designed, in terms of user interface, was about as close to perfect as I can imagine. The GUI menus vs. soft menus were flag enabled/disabled. Graphical menus are pretty, but when three submenus take up the whole screen, it makes the calc less usable. The [Menu] button seems very poorly labeled. It enables copying/pasting from other screens -- but really this should just appear as menu options when we press [Shift][Paste]. [Menu] should then be reserved for the actual 6-buttons the bottom of the screen. Maybe it toggles the actual menu (for more screen real estate) or it is how we enable a custom menu. Or, perhaps [Menu] can even bring up the stack menu.

I digress.. back to RPN. While Ans(n) seems "ok" it does not make for a smooth transition from previous RPN machines. It also makes no sense to have postfix functions since we are talking about RPN here. It seems that RPN has taken a back seat on this particular calculator. If that is the case, then leave RPN limited to just the Home/CAS screens. If you have the man-power and time, it would be nice to have an RPN programming environment, too, as was the case on the HP50G (this would be my personal preference).

#17

Hi Tim,

Since programs are available no matter what mode (Home/CAS) or what app is currently active, these functions should work anywhere. Personally, I would be happy with the following...

ANS(n) - Accesses the current stack, whether it be RPN or the other non-RPN history stacks in Home or CAS. Examples: ANS(2):=5; would write 5 to stack level 2. X:=ANS(3) would make X equal to what is on level 3 etc. Alternatively, instead of array access like this, read/write functions would be fine too but an ANS(n) array is more elegant perhaps.

CALCMODE - returns a number indicating which mode the calculator currently is in. For example, 0:CAS 1:Home/Textbook 2:Home/Algebraic 3:Home/RPN.

SETMODE(n) - Sets the current mode of the calculator as above. That way, if you wanted to retrieve something from level 1 of the CAS stack, you could do so even if in a different mode (RPN for example) as follows: temp:=CALCMODE; SETMODE(0); X:=ANS(1); CALCMODE(temp);

DEPTH - returns the current stack depth.

POP(n) - Pop n values off the stack, effectively discarding them. POP(-1) could be used to clear the stack of all entries (or just POP(DEPTH) I suppose). This would make reading a value off the stack and popping it off a two stage process (ex. X:=ANS(1); POP(1);) but I certainly could live with that.

[edit: I suppose the above should be called DROP(n) and not POP(n) perhaps?]

PUSH(x) - Push the number/expression 'x' onto the stack. Or...

The above -PUSH(x)- is a little inconsistent I suppose, so perhaps instead of PUSH(x), there should be...

PUSH(n) - pushes up the stack n times, leaving zeros on created levels. Then, instead of a PUSH(x) to put 'x' on the stack level 1, you would PUSH(1); ANS(1):=X; and to put two results on the stack for example, it would be PUSH(2); ANS(2):=Y; ANS(1):=X; which is more consistent, but a little more work when you have to use it.

TYPE(n) - indicates what type the object on stack level n is, for example is it a real number, a complex number, a list, an array, an equation and so on.

Of course other functions would be useful, similar to the 50g, so ROLLD, SWAP and so on, but with the above functions, if I needed that level of stack control in a program I could always implement those functions myself. I'm sure others will disagree and wish for more stack control, but even rudimentary access as I've outlined above would a lot better than nothing in my view.

Anyway, that's a start perhaps? I'm probably forgetting something important and I may certainly not understand all the architectural subtleties of the HP Prime. I am still surprised that there apparently is no way to do this already, but I hope something like that could be implemented!

While I am in "wish-list" mode :-), I might as well also mention that being able to organize programs and variables into directories would be very much appreciated too! I had plans to transfer (rewrite) a fair number of programs I had in my 50g for the Prime, but the program and user variable menus will probably get horribly cluttered if I keep things as modular as I did on the 50g. Also, a revert and/or undo command when editing a program would be nice too.

However for the moment, the Prime looks very promising and with a few tweaks here and there, I could see it replacing my 50g. I appreciate all the effort Tim and the rest of the HP Prime team have made since this is truly an awesome new computing tool! I am very glad that progress is being made in the sense that we have a modern new calculator platform going forward, and not just another version of the 48/49/50. That said, a "60g", based on the 50g but with a high-res colour touchscreen, faster CPU, Li-Ion battery and maybe even the Prime's BASIC language for programming, along with the traditional RPL still, would be pretty darn nice too... :-)

Edited: 30 Sept 2013, 3:13 p.m.


#18

Okay, my above PUSH and POP functions are probably not quite consistent with what one normally expects from those named functions. For consistency, POP should simply return the object on level 1, dropping the stack and PUSH should insert an object on level 1, pushing up the stack. Have DROP(n) to discard stack levels.

#19

Clayton, thanks for the alert about the incomplete implementation of RPN.

I have wanted to acquire an HP Prime but, with the RPN mode being as partially implejented as it is (as well as its being implemented as an afterthought) begs the question I must pose to the group: Is the HP Prime worth acquiring. Or, since I already have 50G, there's no need to purchase the Prime?

Members of the group, I appeeciate your recommendations.

Thanks


#20

Quote:
Clayton, thanks for the alert about the incomplete implementation of RPN.

If you are OK with not having RPN for CAS, you'd probably be OK. If you want RPN in CAS mode, though, you're out of luck (unless they change that in a future ROM revision.) RPN in normal home mode works as expected, but some of the stack functions aren't there (as discussed earlier in this thread.) Again, those could be added in a future ROM version as well.

I don't want to sound overly negative at all. I still like the Prime a lot, and I'm trying to wean myself from the 50g in order to make it my primary calculator.

I really wish I could mix the color touchscreen and fast processor of the Prime with the brains of the 50g! :D

-Clayton


#21

Okay. That was helpful. Now that the RPN functionality has been clarified, I think I'll wait a quarter to see if an upcoming ROM update brings more RPN functionality. If not, at least I'll consider a ROM-revised HP Prime.

#22

Quote:
it would have been nice if transition was as smooth as from the 42S to 48 to the 50

I guess it is possible to write a compiler from 50g RPL to PPL.

Anyway, one day we shall have the possibility to replace the native HP system, it will be great !

Didier


Possibly Related Threads…
Thread Author Replies Views Last Post
  Does the HP Prime really compiles the user programs? CompSystems 3 2,841 12-13-2013, 01:55 PM
Last Post: Mike Morrow
  HP Prime: Lists in programs Alberto Candel 7 3,653 12-04-2013, 02:16 AM
Last Post: Alberto Candel
  HP Prime: FLOOR, iPart , and their use in programs Alberto Candel 6 2,703 12-01-2013, 10:17 PM
Last Post: Alberto Candel
  HP Prime: matrices in programs, in need of help Alberto Candel 9 3,358 11-26-2013, 01:33 AM
Last Post: cyrille de Brébisson
  HP Prime: password protection for programs Davi Ribeiro de Oliveira 2 1,636 11-22-2013, 12:45 PM
Last Post: Geoff Quickfall
  HP 50g - select characters on the stack, copy/paste Sean Freeman 7 2,780 11-20-2013, 07:11 AM
Last Post: Sean Freeman
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 2,311 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  Prime: Scope of Variable and functions within programs Thomas Chrapkiewicz 9 3,429 11-18-2013, 03:39 PM
Last Post: Thomas Chrapkiewicz
  Question about transfering programs to the HP Prime Namir 10 3,636 11-17-2013, 04:01 PM
Last Post: Namir
  [Download] PrimeComm: Alternative small utility to upload/download programs to the HP Prime Erwin Ried 6 2,622 11-17-2013, 10:18 AM
Last Post: Erwin Ried

Forum Jump: