ⓘ This web page is about the old AlgoSim 2 software. Perhaps you are looking for the new Algosim 3 application?
AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: defineOperator

defineOperator(kind, symb, func) defines a new operator with symbol symb, a single character (i.e. a one-character string) corresponding to the function func, a string with the name of a (defined) function.

kind is either
* "postfix",
* "prefix", or
* "infix".

In the first two cases, func must accept exactly one argument, and in the case of an infix operator, it must accept two arguments.

defineOperator(kind, symb1, symb2, func) defines a new operator with symbol symb1 ... symb2, two single characters (i.e. two one-character strings) corresponding to the function func, a string with the name of a (defined) function.

kind must be "circumfix", and func must accept exactly one argument.

The newly added operator will have a priority lower than all preveously defined operators.

Examples: defineOperator("postfix", "?", "isPrime")
          53? = true

          defineOperator("circumfix", "$", "@", "totient")
          $80@ = 32