# Halcyon Calc - Working With Symbols

Halcyon Calc can store values into symbols and manipulate those symbols. Working with these symbols is described in the following sections:

# Entering Symbols:

A symbol is a name which can be used to store a value for future use. The symbol name is between 1 and 127 characters long and must not start with a digit. Valid characters in the symbol name are any letter (upper or lower case), digit (as long as it isn't the first character) or one of the following:

• ?
• °
• μ
• π

To enter a symbol on the command line, press the "'" (single quote) button, then hit each button for each character in the name of the symbol, and finally press "Enter". You can also optionally press the "'" button again at the end of the symbol name to close the quotation. If you are entering the symbol "X", you can do that by pressing "'", "X" and finally "Enter". You will find that 'X' will appear on the stack which is a symbol.

Note that when you press the "'" button the first time, the calculator goes into "algebraic mode". When in algebraic mode, pressing buttons which normally execute operations will instead insert text onto the command line. For example, pressing the "SIN" button will append "SIN(" onto the command line. Refer to command line section of the UI Guide for more information about algebraic mode.

Alternatively, if you skip pressing the "'" button and just press "X" and "Enter", the calculator does the following:

• The calculator searches its symbol table to see if the symbol has a value. If so, it pushes that value onto the stack and not the symbol itself. So, in this example, the calculator searches its symbol table for X and if it finds a value, it does not push 'X' but instead pushes the value of X.
• If the symbol does not have a value, then the symbol itself is pushed onto the stack. So, in this example, 'X' will be pushed onto the stack if X has no value currently.

# Storing Values In Symbols:

To store a value in a symbol, push the value you want to store on the stack followed by the symbol you would like to store it into. Then, press the "Sto" button which will pop those two items from the stack and store that value into that symbol. The "Sto" button will execute the STO operation.

Note that anything which can be pushed onto the stack can be stored in a symbol. Not only real and complex numbers, but lists, strings, expressions and even other symbols can be stored in a symbol.

A common use for symbols might be to declare your own constants. Perhaps you often need to do calculations with Avogadro's constant. If so, you can store the value 6.02214179E23 into the symbol "N". Then, whenever you need to work with that constant, you can just recall the value of "N".

# Recalling The Values Of Symbols:

There are two ways to recall the value of a symbol. The easy way is to enter the name of the symbol at the command line without prefixing it with a single quote. An unquoted symbol name is looked up and if a value is found, the value is pushed onto the stack. Otherwise, the symbol itself is pushed onto the stack.

The alternative is to push the symbol onto the stack and then press the "■Rcl" button. Pressing this button will execute the RCL operation and pop the symbol from the stack and replace it with the value of that symbol. If the symbol has no value associated with it in the symbol table, an error will be displayed.

# Clearing The Values Of Symbols:

If you no longer need the value of a symbol and would like to clear the symbol from the symbol table, use the "■Purge" button. To purge the value of a symbol, push the symbol name onto the stack and press the "■Purge" button. This button executes the PURGE operation and it pops the symbol name from the stack and removes that symbol from the symbol table. Any value associated with that symbol is lost.

# Browsing Symbols:

If you don't recall the symbols in the symbol table or would like to quickly recall the value of several symbols, press the "User" button. This will cause a special set of menu buttons to slide in. Each page of six menu buttons will show a symbol name (truncated if necessary to fit on the button). You can swipe to the left and right to view the different pages of buttons or use the "Next" and "■Prev" buttons to flip through the pages. This is a great way to review which symbols you have created.

When you press one of these buttons, the value of that symbol will be recalled and pushed onto the stack. Also, if you press "'" first (or put the calculator in algebraic mode), then the symbol name will be appended to the command line. If the button you press is labelled "X", then the command line will now read 'X. So, pressing "Enter" will push the symbol name onto the stack (in this case, 'X' will be pushed onto the stack). Using these two methods, the "User" menu is a great way to get the value of a symbol or to push the symbol name itself onto the stack.

# Organizing Symbols:

By default, the newest symbols created are shown earlier in the "User" menu buttons. The oldest symbol created will be on the last page. But, you may find this default order difficult to use. If so, you can use the ORDER operation from the "Memory" menu to tweak the order of symbols. First, create a list of symbol names in the order you would like them to appear. You don't need to include all symbol names and any left out of the list will be put at the end. Push the list of symbols onto the stack and then execute the ORDER operation. After execution, the list will be popped from the stack and the symbols in the "User" menu will be re-ordered.

If you want a list to start with, you can execute the VARS operation from the "Memory" menu. This operation will push a list of symbols onto the stack in the order they appear right now. You could then edit that list and re-order some symbols to prepare it for use with ORDER operation.

But, in some situations, you really would like to keep a group of symbols together and separate them from other symbols. For this, you can create directories of symbols. Note that directories are not supported on Halcyon Calc Lite. By default, the calculator starts with a single root directory called "HOME". If you want to create a directory called DIR1, you push the symbol 'DIR1' into the stack and then execute the CRDIR operation (CReate DIRectory) from the "Memory" menu. The operation will pop that symbol name from the stack and create a directory with that name in the current directory. It does not change the current directory.

To change to a directory, you can type the symbol for that directory into the command line without the "'" prefixing it. When the calculator looks up the "value" of the symbol, it finds that the symbol is a directory and then switches to that directory. Alternatively, if you bring up the "User" menu and press the symbol button for that directory, then the calculator switches to that directory.

When the calculator switches to a directory, the following things happen:

• When you press the "User" menu button, you only see the symbols which exist in that directory.
• When you store a value in a symbol, that symbol will be created in the current directory.
• When you look up the value of a symbol, the calculator checks the current directory first. If it finds the symbol there, it recalls that value. If not, it checks the "parent" directory of the current directory. It continues checking until it gets to the "HOME" directory and if it is still not found, then the symbol lookup fails.

The lookup behaviour means that some good rules of thumb when using directories are:

• If you want to have a symbol with two different values, you can store one value in one directory and put the other value in the other directory. Do not create one of these directories in the other. Instead, create them both in the "HOME" directory for example. Then, switch into one of these directories and perform calculations with one value. When you want the other value, switch to the other directory.
• If you have a single value which you want to be accessible in two different directories, put them in a common parent. A good place might be in "HOME". For example, physical constants might be a good thing to store in "HOME" since they always will have that value.

At any time, you can use the PATH operation from the "Memory" menu to get the current directory path. This operation will push a list onto the stack which starts with the symbol HOME and each successive symbol is the next directory which eventually leads to the current directory the calculator is set to. Also, if you want to descend to a different directory, you can execute the HOME operation from the "Memory" menu to return back to the "HOME" directory. From there, you can descend through to a different directory.