Interactive mode


Next: Colon Definitions Up: COD Previous: Introduction

Interactive mode

The best way to learn about COD is to run the COD program and experiment. This can be done with

$ COD
Type HELP for help.

COD>
When COD starts, it first prints information on how to get help, followed by a blank line. The blank line actually displays the contents of the stack, which is initially empty. Finally, you get the ``COD>'' prompt. At this prompt you can type HElp to obtain interactive help on the various commands and how to use them.

The first thing you will want to do is to enter a number into the stack. This is done by typing the number and then pressing the Return key. For example, to enter the number 2 into the stack,

COD> 2
 2.0
COD echos the stack and then returns the COD prompt. (In this documentation the final prompt is not shown.) To execute a simple mathematical function enter, all the numbers required by the function and then the function itself. The following sequence shows how to multiply the previously entered 2 by the number 3 to obtain 2*3:
 2.0
COD> 3
 2.0 3.0
COD> *
 6.0
With COD it is not necessary to enter one token (number or function) per line. Tokens may be entered, separated by spaces, on a single line. Hence, to divide the result of the previous calculation by 0.5, enter
 6.0
COD> .5 /
 12.0
COD contains several commands to manipulate the stack. Thus SWap will swap the top two numbers on the stack, and DUP will duplicate the top number on the stack. When using COD interactively, you will sometimes wish to clear out the stack. The can be done using the ABOrt command. Thus,
 12.0
COD> ABOrt
and the blank line indicating an empty stack will again appear just before the following COD prompt. There are a large number of built-in COD functions. To obtain a list of the functions, you may use the List Dictionary command. If you see a function and would like more information on what it does, you should use the HElp Dictionary command. For a complete list of built-in COD commands, consult Appendix A.



next up previous contents
Next: Colon Definitions Up: COD Previous: Introduction



Web Page Maintained by: Dr. Lawrence E. Brown elwin@redshift.gsfc.nasa.gov