NAME
Soar righthand side functions
DESCRIPTION
Soar supports a number of functions which can appear on the
righthand side of productions. These functions can appear
either as values (such as the "int" of a number), or as
standalone actions (such as "write" or "halt"). The righthand
side functions can be used to stop or pause Soar, do text input
and output, execute mathematical functions, generate and
manipulate symbols, modify learning, and execute Tcl commands.
The Soar User's Manual should be consulted for more information
on the use of righthand side functions.
The available righthand side functions are:
- accept
- suspends Soar's execution and waits for the user to type a constant,
followed by a carriage return. The result of the accept is the constant.
- capitalize-symbol
- given a symbol, this function returns a new symbol with
the first character capitalized.
- crlf
- short for "carriage return, line feed," this function can be called
only within write. It forces a newline at its position in
the write action.
- dont-learn
- when learning is set to except, by default chunks will be formed in
all states; the dont-learn RHS action will cause learning to
be turned off for the state specified in the LHS (condition side)
of the production.
- force-learn
- when learning is set to only, by default chunks are not formed
in any state; the force-learn RHS action will cause learning to
be turned on for the state specified in the LHS (condition side)
of the production.
- halt
- terminates the current run, stops Soars execution and returns to
the user prompt. halt should not be used if the current run is
to be restarted. (see interrupt below.)
- ifeq
- checks if the first argument is "eq" to the second argument. if it
is, then return the third argument, else return the fourth argument.
Similar to the "?" notation in C. all four arguments are required.
- interrupt
- causes Soar to stop at the end of the current phase, and return to
the user prompt. Similar to halt, except the run may be
continued.
- make-constant-symbol
- returns a new constant symbol which is guaranteed to be different
from all symbols currently present in the system. with no arguments,
it returns a symbol whose name starts with "constant". With one or
more arguments, it takes those argument symbols, concatenates their
names and uses the resulting string as the prefix for the new symbol.
- strlen
- returns the length of the output string so that users can get the
output to line up nicely. useful with ifeq when the output
string varies in length.
- timestamp
- returns a symbol whose print name is a representation of the current
date and local time.
- tcl
- concatenates its arguments into a string which is sent to the
agent's Tcl interpreter for evaluation. It does not automatically
insert spaces between arguments; users must explicitly insert
spaces within vertical bars.
- write
- writes its arguments to the user interface. it does not automatically
insert blanks, line feeds, or carriage returns. It should be used
only for simple monitoring and debugging.
- +
- prefix notation for addition. If all arguments are integers,
this function returns an integer, otherwise it returns a real number.
- *
- prefix notation for multiplication. If all arguments are integers,
this function returns an integer, otherwise it returns a real number.
- -
- prefix notation for subtraction. If all arguments are integers,
this function returns an integer, otherwise it returns a real number.
- /
- prefix notation for division. always returns a real number.
- div
- prefix notation for binary integer division. returns the integer
quotient. Both arguments must be integers or an error occurs.
- mod
- prefix notation for binary integer modulus. returns the integer
remainder when dividing the first argument by the scond. Both
arguments must be integers or an error occurs.
- sin
- returns as a float, the sine of the angle which must be
given in radians.
- cos
- returns as a float, the cosine of the angle which must
be given in radians.
- atan2
- returns as a float in radians, the arctangent of the first argument
divided by the second argument. the arguments can be integers or floats.
- sqrt
- returns as a float the square root of its argument, which can be
a float or an integer.
- abs
- returns the absolute value: of a float as a float; of an integer
as an integer.
- int
- converts a symbol to an integer constant. argument must be either
an integer constant, a floating point constant, or a symbolic constant
which can be interpreted as a single integer number.
- float
- converts a symbol to an floating point constant. argument must be either
an integer constant, a floating point constant, or a symbolic constant
which can be interpreted as a single floating point number.
WARNINGS
The tcl RHS function is not part of the Soar kernel.
It is added by the Tcl interface code. You can get into a lot of
trouble with it, as the arguments are unrestricted. It should
be used only with great care.
SEE ALSO
learn, stop-soar