Go to the previous, next section.


DC can operate on strings as well as on numbers. The only things you can do with strings are print them and execute them as macros (which means that the contents of the string are processed as DC commands). Both registers and the stack can hold strings, and DC always knows whether any given object is a string or a number. Some commands such as arithmetic operations demand numbers as arguments and print errors if given strings. Other commands can accept either a number or a string; for example, the `p' command can accept either and prints the object according to its type.

Makes a string containing characters and pushes it on the stack. For example, `[foo]P' prints the characters `foo' (with no newline).

Pops a value off the stack and executes it as a macro. Normally it should be a string; if it is a number, it is simply pushed back onto the stack. For example, `[1p]x' executes the macro `1p', which pushes 1 on the stack and prints `1' on a separate line.

Macros are most often stored in registers; `[1p]sa' stores a macro to print `1' into register `a', and `lax' invokes the macro.

Pops two values off the stack and compares them assuming they are numbers, executing the contents of register r as a macro if the original top-of-stack is greater. Thus, `1 2>a' will invoke register `a''s contents and `2 1>a' will not.

Similar but invokes the macro if the original top-of-stack is less.

Similar but invokes the macro if the two numbers popped are equal.

Reads a line from the terminal and executes it. This command allows a macro to request input from the user.

During the execution of a macro, this command exits from the macro and also from the macro which invoked it. If called from the top level, or from a macro which was called directly from the top level, the `q' command will cause DC to exit.

Pops a value off the stack and uses it as a count of levels of macro execution to be exited. Thus, `3Q' exits three levels.

Go to the previous, next section.