Directories

Directories are containers for storing any other type of object (a variable, list, or another directory). One can think of them as forming a filesystem like on any computer. The root directory is defined to be HOME, which is the current directory when the newRPL system is initially booted. Creating and deleting directories (known as subdirectories) within HOME is accomplished with the CRDIR (create directory) and PGDIR (purge directory) commands.

As an example, this creates the subdirectory TEST from the current working directory:  'TEST' CRDIR

The directory name is enclosed in single quotes (as opposed to strings that use double-quotes as delimiters). Now the TEST subdirectory shows up as an object in the soft menus. Selecting it enters that directory, and the current directory path is displayed in the status area. To move back up to the parent directory, use the command UPDIR. Anywhere in the directory tree executing HOME will return the user to the root or HOME directory.

To delete a directory, use the command PGDIR. Note that this command will delete the directory and all subdirectories, so use it carefully, especially if there are variables stored in the directory as currently there is no confirmation for purging non-empty directories.

Variable Storage

Storing objects, or variables, within a directory is accomplished with the STO and RCL commands.

For example: 42 'Mynum' STO

will store the number 42 into the named variable 'Mynum', and to recall this newly created variable to the stack either press the corresponding soft menu key or,  'Mynum' RCL

To delete a variable, use the command PURGE with the variable name in single quotes on the stack.

There are two other ways to quickly store/recall variables:

1. Use the dedicated store and recall keys, which are now mapped to the M and LS-M keys, respectively. So, to store the number 42 as above, put 42 and 'Mynum' on the first two levels of the stack and press M. To recall the number, simply put 'Mynum' on the stack and press LS-M.

2. Use the shortcut keys for moving variable contents into and out of soft menu key assignments: RS-{A..L} recalls the variable to the stack, and LS-{A..L} stores the contents of stack level 1 to the soft Menukey. Note that it can be easy to make a mistake using this last method and wipe out the variable (or, more generally, any object) stored in a soft menu key. This becomes particularly dangerous when storing whole programs since they can be inadvertently lost if the wrong shortcut key is used. However, newRPL has a built-in way to protect variables with the command LOCKVAR.

Special Variable Commands

The following commands are useful for adding special characteristics to a variable (for each command the variable name should be in single quotes on the stack):

LOCKVAR, mark variable as read-only

UNLOCKVAR, mark variable as normal read or write

HIDEVAR, variable will not be visible in soft menu (but still is accessible by EVAL on variable name in single quotes)

UNHIDEVAR, variable is made visible in soft menu

• manual/chapter4/dirs.txt