RPN HP39gII : An attempt to summarize our discusion - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: RPN HP39gII : An attempt to summarize our discusion (/thread-227741.html) |
RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-26-2012 The 24 of July, Tim Wessman was kind enough to ask us, HP calcs users, what could be RPN on something like a HP39gII , how would we like it done? What would be "absolutely critical"? What would be nice but not critical? Here is (in my bad english) an attempt to summarize our discussion. Sorry for mistakes, errors or forgetting things...
« RPN HP39gII » : An attempt to summarize our discusion 1/ We want RPN ! Not surprisingly, all contributors think that RPN on a device like the HP39gII would be wonderfull. However for Patrice, it is first critical to fix operator prority on the present HP39gII ( modulo command). 2/ About the stack Most persons who spoke on the subject prefer an infinite stack. Christian would prefer something like a 50G stack (infinite stack, and SPC or ENTER as separators, and no DUP on ENTER ). However Bill Wiese think the perfect programmable calculating device has bone-stock HP RPN with big ENTER key, XYZT+L registers, Z copy down etc. No general idea emerges about what could be the stack manipulation commands (Nota : but it is an important topic, an infinite stack could not be manage as a finite stack – we must disuss this.
Gilles wrote that the "forth legacy" is fine for him, but perhaps more mnemotechnics commands could be interesting 3/ RPN vs RPL
As usual, 'classic RPN' vs 'RPL RPN' was in debate. Some find RPL too complex (Pal G ...), others find it simple to use and very powerfull (Oliver ...) Others (Wes Loewer...) find 'classic RPN' very hard to follow compared with RPL more easy to read. But Even those who like RPL wrote that there are some problems : For Eddy RPL and RPN are basically the same structure. Instead of commands like x>y?, LBL, GTO, R/S, and ISG in RPN, we have commands FOR-NEXT, WHILE-END, PROMPT, WAIT, and PAUSE in RPL. Both use objects in the stack and manipulate them to obtain desired results. Both are more challenging to read than say, a program written in BASIC. 4/ Programming vs interactive usage RPN yes ! At least for interactive usage. But what about programming ? Some people (Jim Horn, Christian …) wrote interactive use and programming aspect are quite different situations. So we could have RPN for interactive usage, and 'classic' 39gII language (no RPN entry) for programming. Gilles thinks it's not a good idea at all to have such a difference between the 2 modes (the power of a 50G/RPL is here !). 5/ About programming X34 and other people think there is no need to have RPL, since what X34 called « Modula-39 » ;) is much more structured, orthogonal, simpler and more powerfull one. Gilles and Oliver wrote that you can do many things in RPL in a more easy way than in the 39gII embedded language. All noted that the 39gII language is very readable and clear...Some wrote it must be improved (for example the lack of MAP command, retrieve the TYPE of a variable, List processing …) Several people wrote that it's not a problem to have several languages on such a calc (like on the 50g) Four ideas emerged about programming : a/ RPN OK, but for interactive use only and keep the 39gII langage as it is. No need of RPN/RPL language b/ RPL legacy. RPL is a powerfull and perfect language for a calc. Keep it ! Improve it ! c/ Classic RPN legacy. RPN 'classic' is a perfect tool for a Calc. We want it ! d/ HP39gII language is interesting and could be adapted to a Reverse polish notation with small efforts Hummm... Do with this Tim ;) 6/ An alternative way : RPN and algebraic, Both for the same price ! Bill Wiese wrote that functions could run in postfix calc mode or prefix-with-arguments mode in BASIC. Oliver (who create RPL+) show us we can mix in a smart way RPN/RPL and algebraics. Gilles also think so. The idea is to have a calc wich works _in the same time_ both in RPN and algebraic
IF sum>(n^2/log(10)) THEN … (no space => algebraic object)
So we could do : 'SIN(X)' 'LOG(3*X)' * give 'SIN(X)*LOG(3*X)'
P1 P2 P3 Myfunction Another way would be to use ' or ` to diffenciate RPN and algebraic part. (immediate and delayed evaluation).
Edited: 26 July 2012, 6:21 a.m. after one or more responses were posted
Re: RPN HP39gII : An attempt to summarize our discusion - Software49g - 07-26-2012 Hello,
Alternatively simply update the 50g with some more memory and a larger screen to
Edited: 26 July 2012, 6:16 a.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-26-2012 Hi Andreas,
Quote: Give me this, easier local variables definition in RPL and some BREAK and CONTINUE command and I will be an happy man ;D RPL is also a perfect system for CAS use ... And the 50G CAS is very interesting even if there is no more evolution since years.
On the details of your message, I can say nothing because if I use a lot RPL I know quite nothing (nor I want to know) about "how it works", neither about SYS-RPL. But as far as I know, your message seems makes sense.
Re: RPN HP39gII : An attempt to summarize our discusion - Bart (UK) - 07-26-2012
Quote:NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO That's just keystroke programming, nothing more than a BASIC macro language. Good for programmable basic scientific clacs (10C series, 32 series etc.), but NOT for an advanced graphing calculator. Statement c/ shows again how this forum is just dominated by old-timers that are stuck in their ways. I am a lover of RPL. When I started with RPL I felt it was the next step to a higher level programming on claculators - time to leave the old keystoke & BASIC models behind. But even I know that after 25 years it is time to move on. Just as I have reluctantly left my Scout unit to let a younger leader take the reigns, it is time for something new & "younger" to take shape in the calculator world. Mr Tim Wessman, please go speak to young professionals and also students currently in university or college. Find out what they want to see in a calculator - they are your future customers. Footnote: Does this mean the end of RPN or an RPN like calculating structure? With the modern "textbook" type entry systems it's all a bit of a moot point anyway. Why struggle with intermediate results on a stack (RPN) or counting parentheses (ALG), when you can see the whole formula and easily review it for correctness? Re: RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-26-2012
Quote: Hi When I work with RPL, I use a lot algebraic formula. I use the marvelous equation writer to create or edit them. Then they are on the stack or in variable. But I need an easy way to work with them. And RPN (I mean reverse polish notation) is the simplier way I know
Suppose you have on the stack something like
and another part (calculating elsewhere) with You want the 2 parts to be equal. Just push the = key and you get : 3*Y+SIN(X)/e^X=1/Y' Now you want to solve for 'Y' function of X 'Y' SOLVE give (in more beautiful presentionthan here) :
{ You want only the second 2 GET (or EVAL NIP, or EVAL SWAP DROP with 3 key pressed)
'Y=(-SIN(X)+sqrt(12*EXP(X)^2+SIN(X)^2))/(6*EXP(X))' There is a future for RPN : It is to eat algebraic and manipulate it.
Edited: 26 July 2012, 8:48 a.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Pal G. - 07-26-2012 Bart, I agree with one of your footnote points, but disagree with the other. 1) Equation writer is very slick when typing a large equation. I agree too many parenthesis can lead to typos and errors, and can obfuscate an otherwise easy to read equation. Unfortunately, I don't think the 39GII has an equation writer. 2) Dealing with intermediate results on a stack is not a struggle, it is desired. I want intermediate results. It is the primary reason I learned RPN. ALG mode insists you enter the entire equation, then reveals the answer or complains with an error message if your parentheses are wrong.
Edited: 26 July 2012, 5:17 p.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Eric Smith - 07-26-2012 Quote: How is local variable definition hard? How would you make it easier?
Quote:
At first I thought you were asking for what RPL provides as HALT, but maybe you mean the equivalent of break and continue in C?
Re: RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-26-2012 - How is local variable definition hard? How would you make it easier? Suppose you need a 3 local variables in RPL, but you don't kwow in the beginning of a 'bloc' what are their values You can do something like :
and if you 10 local variables, is not very beautiful Is it not more logic and easier with ythis alternative :
<< BREAK is to exit a loop structure (FOR / REPEAT / DO ...)
1 100 FOR n CONTINUE to jump to the start of the next iteration You can do without, but in some case it is very usefull
Edited: 26 July 2012, 1:43 p.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Eric Smith - 07-26-2012 Without making really big changes to the implementation of RPL, I think you'll still need a set of guillemets around the scope of the local variables, since it needs to be a block:
<< I have only rarely found the need to have local variables without a needed initial value, and when I have needed them, I've rarely needed more than two, so I don't think I'd personally find this feature to be of much use. And I think I can type
0 0 0 -> a b c faster than I can type
{ 'a' 'b' 'c' } LOCAL anyhow.
On the other hand, I agree that CONTINUE and BREAK would be very useful.
Re: RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-26-2012 In fact here is already a LOCAL command in the 50G : see AUR page 3-137
LOCAL
I tried to use it in RPL (seems not forbidden), but without success.
Edited: 26 July 2012, 5:59 p.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Oliver Unter Ecker - 07-27-2012 Quote: To define, assign, and re-assign a local in RPL, you have to do: << -> n <<One possible solution is what RPL+ does: << =nNote: - using "=" to do assignment assignment and re-assignment; like most any language Keeping in mind immediate algebraics which work by having no spaces in an expression, finally, another way emerges: << =nAnd now, this looks like in most languages and everyone will get it. The "=n" may look strange but a quick explanation that this assigns whatever's on the stack will be understandable to people. And, it's a very strong feature, as "=n" is much more concise than having to declare an input.
There should be no need to declare a local. Just assign whenever you need it. If you use a never assigned local name it becomes a "name" in RPL, as always. << =xreturns 7 for inputs smaller than 10 and 'y', otherwise. Another thing that locals should do, is have "block scope", where code fragments (declared with << >> or { }) are our blocks. That is, they should be usable from within such code fragments. This is another expectation from most languages and also permits things like recursive anonymous functions. The proposed changes are pretty easy and I can report from using local vars like this in RPL+, that I've never looked back. (Though RPL+, being strictly a superset of RPL, allows you to work the old way, too, and even mix and match old and new.)
Once you have the syntax above, the next step is to replace STO+, STO/, etc. with x+=5
RPL+ does allow 5 =+x
Also, it permits array access, read and write, like so x[3]
Combine that with immediate algebraics, and you have x[5+y*2]=log(f)*5
Even though this looks like "every other" language now, it's still RPL! Everything you know about RPL still works. It's just an option to also write things, and not alienate new users. (Not that I'm suggesting "RPN" users would embrace this style, of course...) Edited: 27 July 2012, 4:27 a.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-27-2012 I like very very much the general idea... In fact, RPL+ seemed mysterious to me before because I did not understand the importance of space character To mix in such an easy way RPN (i mean reverse polish notation) and algebraic is very powerfull. You can have the best of the 2 worlds in the same time ! Just be carefull about distinguish the "=" for affectation and the mathematical equal "=" .
I dont like very much "=" for affectation, because A=A+1 is a non sense. I prefer the := of the 39gII for example, or => and <= . But its a detail.
Edited: 27 July 2012, 6:13 a.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Crawl - 07-27-2012 I like RPL, but I think it can stand to be improved. There probably needs to be a source and executable file,so you can have formatting, comments, etc. If it had that, I don't think RPL would necessarily be that hard to read. Some other suggestions in this thread for an evolved RPL could be good.
Re: RPN HP39gII : An attempt to summarize our discusion - Software49g - 07-27-2012 > There probably needs to be a source and executable file, Re: RPN HP39gII : An attempt to summarize our discusion - George Litauszky - 07-27-2012 Quote:IMHO it's more readable and sensible (corrigible) if you declare the all variables at the beginning of the program file like the Pascal. With 0 for example. And later if you know the value of the variable, simple go back to the top and rewrite it. In this case you know: Your all variables are declared in a common block, and you need not search them in the whole program file.
Edited: 27 July 2012, 3:45 p.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Oliver Unter Ecker - 07-27-2012 Hi Crawl, You don't need two separate files in order to have RPL preserve user formatting. I think it's purely a historic accident (based on the then-valid rationale that every byte is precious) that explains that RPL on HP 28-50g was compiled into pointers when entered. Representative of how it could be done elsewhere, ND1 does no such thing and simply compiles when the need for execution arises. If a RPL code fragment is used in a processing command like DOSUBS, filter, or such, it's compiled before use and then reused in compiled form in the internal loop. But the only thing the user ever sees is the user formatting-preserving text form. If HP produces another RPL-capable machine, I'm sure they'll fix that in the same way. And, yes, agreed, automatic formatting didn't exactly help readability of RPL.
Edited: 27 July 2012, 5:21 p.m.
Re: RPN HP39gII : An attempt to summarize our discusion - Gilles Carpentier - 07-27-2012 For "big" programs, i think the best is to write them on a PC, tests and then tranfer. So you can put comments in the PC file with @ and the formatting is preserved.
For UserPRL HPUserEdit is a prefect tools and works fine with EMU48 (just click TRANSFER)
Re: RPN HP39gII : An attempt to summarize our discusion - Bart (UK) - 07-29-2012 See the following: Re: RPN HP39gII : An attempt to summarize our discusion - Crawl - 07-30-2012 That may be well and good, but there's no reason a future iteration of RPL shouldn't have that built-in.
Yes, I know about using error trapping to break loops, but, come on, I think we have to admit that is an unintuitive solution to the problem.
|