Go backward to Creating preferences.
Go up to The action side.
Go forward to Grammar for Action Side.
Production Action
.................
In addition to creating preferences, there is a small set of additional
functions that can be included in the actions of Soar productions. The only
ordering of actions is between multiple writes and accepts within a single
production. See Section See Adding RHS functions on page *Note Adding
RHS functions:: for how the user can define new actions.
[halt] Stops Soar's execution and returns to the user prompt. It
should not be used if Soar is to be restarted (see interrupt.)
(halt)
[interrupt]
Executing this function causes Soar to stop after the end of the current
preference phase. You put this on a production's RHS just like halt,
but instead of terminating the run, it just interrupts it as if you
typed ctrl-c.
(interrupt)
[write] Writes each of its arguments to the standard output.
It does not automatically insert blanks, linefeeds, or carriage returns.
If <o> is bound to 4, then
(write <o> | x|)
prints
4 x
Although write is provided as an action in Soar, it should be used for
only simple monitoring or debugging. Text input and output, as
described in Chapter See Adding Input and Output Routines on page
See Adding Input and Output Routines, should be used for all other
interaction using text.
[accept] Suspends Soar's execution and waits for the user to type
an atom (i.e., constant). The result of accept is that atom. In general,
text input should be used instead of accept.
(<s> ^input (accept))
[+, -, *, /, div, mod]
These symbols provide prefix notation arithmetic functions. Expressions
can be nested to any depth. / always produces a floating-point result,
even if its arguments are integers. div takes two integers and returns
their quotient; mod returns their remainder.
(^sum (+ <x> <y>)
^product-sum (* (+ <v> <w>) (+ <x> <y>)))
[crlf] Short for "carriage return, line feed", this function can be
called within write. It forces a new line at its position in the write
action.
(write <x> (crlf) <y>)
[make-constant-symbol] This function returns a new constant symbol
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 that as the prefix for the
new symbol. (It may append a number to the end, if a symbol with that
prefix as its name already exists.) This is particularly useful when
used in conjunction with the timestamp function.
[timestamp] This function returns a symbol whose print name is a
representation of the current date and (local) time. By using this as
an argument to make-constant-symbol, you can get a new symbol that is
guaranteed to be unique for all eternity.
(<g> ^new-symbol (make-constant-symbol (timestamp)))