Congrats on your first successes with RPL!
Ok, you found the ≪, ≫ symbols in the Program menu. These simply frame a RPL program. You find ≪ over the space key in the bottom left.
As the closing symbol is appended automatically when you enter code, the easy way to write an RPL program is to
- Enter ≪ from the keypad
- Double-tap the edit line to get it expanded if you plan to write a multi-line program
- Type your RPL commands
Now, the RPL program will "sit on your stack". (Specifically, at position 1.)
You can now proceed to store it under a name, *or*, and that was the point I was trying to make, you can tap the ⌘ (EVAL) key.
The Eval key does various things, depending on the kind of object it's invoked on. Invoked on an RPL program, it will run the program. That is, you don't have to have a program stored in a variable to try it out. If you're in a edit/run cycle as you develop code, not having to store the program every time you do an edit comes in handy.
To edit an RPL program that's at position 1 on the stack, you tap EDIT (over the ENTER key), as I assume you found out.
(I hope you'll come to appreciate that those cryptic keys on the keypad are actually quite ergonomically placed, once you have gotten used to them. Also, sooner or later, try the Modern keyboard layout, it looks more cryptic, but it *is* better (plus, nine softkeys do make a nice difference).)
Most ND1 users come from an HP calc and know about all the RPL stuff. The documentation for the app is not very suitable for someone starting out with RPL programming, I'm afraid. However, you can google for the HP-50g User manual and go through a "proper" RPL learning steps, and study annotated code. You will find two downloadable folders with HP-28 and HP-50g example code under My Data | Downloadables.
ND1 introduces RPL+, which is, I think, an easier and better language, and I will invest time into writing more comprehensive documentation for it, as soon as there's time. (You may have noticed, there's an ambitious road map and ND1 is long not done. And features tend to come before documentation, I confess. CalcPad for the iPad (coming soon) will be a better learner's and coder's environment, fully using the bigger screen and optionally showing a function's documentation, as you select a function.)
HALT can appear anywhere within ≪ ≫. As soon as the program flow hits it, the calc switches from running silently to single-stepping with that dialog that shows you the stack and permits you to either advance a step, or Cancel and abort the program. There's not much more to it. And, sorry, there's presently no tutorial for debugging, I'm afraid. (The HP manuals will talk about HALT, too, though.)
Have fun on your RPL journey and don't let the intricacies of balancing the stack discourage you. RPL+, http://naivedesign.com/ND1/ND1_Reference__RPL+.html
, allows you to assign and re-assign local variables with ease (the syntax is "=x", or whatever variable name you want), and this allows to eliminate much or all of the DUP, SWAP, and DROP instructions that can render traditional RPL program quite hard to read.
P.S. In v1.4, the example at hand can even more shortly be written in RPL+ like so
- Code: Select all
≪ [ randomize 0.5 - 18 * 0 RND ] mmap ≫
(a new command in v1.4) stands for "matrix map". It takes a matrix and a program and runs the program on every cell in the matrix.