1
RPL Programming
If you’ve used a calculator or computer before, you’re probably familiar with the idea of programs. Generally speaking, a program is something that gets the calculator or computer to do certain tasks for you — more than a
Understanding Programming
A calculator program is an object with « » delimiters containing a sequence of numbers, commands, and other objects you want to execute automatically to perform a task.
For example, a program that takes a number from the stack, finds its factorial, and divides the result by 2 would look like this: « ! 2 / » or
«
!
2
/
»
The Contents of a Program
As mentioned above, a program contains a sequence of objects. As each object is processed in a program, the action depends on the type of object, as summarized below.
Actions for Certain Objects in Programs
Object | Action |
|
|
Command | Executed. |
Number | Put on the stack. |
Algebraic or `Algebraic` | Algebraic put on the stack. |
String | Put on the stack. |
List | Put on the stack. |
Program | Put on the stack. |
Global name (quoted) | Put on the stack. |
Global name (unquoted) | Program executed. |
| Name evaluated. |
| Directory becomes current. |
| Other object put on the stack. |
Local name (quoted) | Put on the stack. |
Local name (unquoted) | Contents put on the stack |
|
|
As you can see from this table, most types of objects are simply put on the stack — but
RPL Programming