User Tools

Site Tools


trainingtutorial:create_code

Creating Code

The obvious way to create code is to just type it in but there are also some features in the procedure editor dialogue that will help.

For lots of tips on tool coding see: How Tos

Clicking in variable and informant names

In the boxes to the left of the main edit box double clicking on an entry will past it into the main edit box. The dimensions inside the square brackets will always match the declaration of that variable. For input and output variables the dimensions will match what is in the diagram and for locals it will match what is on the “local” declaration line in the code.

It is VERY important to note that the dimensions inside the square brackets “[]” is ONLY guidance for the user and is completely ignored by the parser. It can happen that these indicies get out of sync with the code and so they should be considered questionable and verified with a seeshape (varname[]) whenever you aren't sure.

<Ctrl> Double Click in left hand panel

This operation gives you the properties dialog for whatever you select. This is useful for checking shape, history, and notes information for variables and for checking element names for informants.

This feature does not work on locals

Right Click in Informants box

This will popup a menu where you can choose “Copy Elements”. If chosen all the element names of that informant go into the clipboard and can then be pasted into the main edit window.

This is particularly useful when extracting or inserting specific elements. Also useful when creating maps where all the element names are needed.

Parser Important Information and Limitations

  • The parser reads and executes left to right ALWAYS, it does not obey regular math ordering - BEDMAS (brackets, exponents, division, multiplication, addition, subtraction)
  • Multiplication is NOT “Matrix” multiplication it is cell by cell multiplication with matching of the indicies. When there is a dimension in
  • Nesting of tool calls works to any depth, however, it can only be done for the left most inputs of the inputs for example:

Example 1 Nesting:

  • This works (because the sum is the first input to the booleq tool):
A[] = booleq (sum (B[x]; dim=xName), 0) 
  • but this does not (because the sum is now the second input to the booleq tool)
A[] = booleq (0, sum (B[x]; dim=xName)) 

Example 2 Nesting with infix

  • Similarly for infix calling of tools, this works (because the sum is the first input to the “+” tool):
A[] = sum (B[x]; dim=xName) + 1 
  • but this does not (because the sum is now the second input to the “+” tool)
A[] =1 + sum (B[x]; dim=xName)  
trainingtutorial/create_code.txt · Last modified: 2009/12/22 15:12 by shona.weldon