Next: TeleoR Specific Actions, Previous: Other Relations, Up: Built-Ins [Contents][Index]
Fork a new Qulog thread, give it the name
Name
, and start the thread executingAction
. IfName
is a variable it will be instantiated to a name given by the system. IfName
is given it must not be the name of an existing thread.
act fork_as(actcall, ?atom)
Alternative syntax:
fork Action as Name
Fork a new Qulog thread, give it the name
Name
, and start the thread executingAction
. IfName
is a variable it will be instantiated to a name given by the system. IfName
is given it must not be the name of an existing thread. The sizes of the various memory areas is set to be very small. This produces a very light weight thread and is useful for threads that do minimal computation - for example a simple message handling thread.
act fork_light_as(actcall, ?atom)
Alternative syntax:
fork_light Action as Name
This is the agent message receive action. It will succeed it there is a message term in that threads message buffer whose message term unifies with
Term
and whose agent handle unifies withHandle
. If not the call will suspend and be repeatedly retried as new messages arrive until it succeeds. When it does succeed, the matched message will be removed from the message buffer.
act from(term?, ?agent_handle)
Alternative syntax:
Term from Handle
This is the agent message send action. It sends
Term
as a message to the agent (of possibly a process on another machine) whose agent address isHandle
.
act to(??term, !agent_handle)
Alternative syntax:
Term to Handle
This is the message receive action. It will succeed it there is a message term in that threads message buffer whose message term unifies with
Term
and whose handle unifies withHandle
. If not the call will suspend and be repeatedly retried as new messages arrive until it succeeds. When it does succeed, the matched message will be removed from the message buffer.
act from_thread(term?, ?handle)
Alternative syntax:
Term from_thread Handle
This is the message send action. It sends
Term
as a message to the thread (of possibly another process on another machine) whose address isHandle
.
act to_thread(??term, !agent_handle)
Alternative syntax:
Term to_thread Handle
Causes the executing thread to suspend for
Secs
seconds.
act thread_sleep(!num)
Dynamic facts can be remembered and forgotten using the actions below. Each such action atomically modifies the collection of dynamic facts.
forget_remember(Forget, Remember)
Forget the dynamic facts that match the patterns in
Forget
and then remember the dynamic facts inRemember
Alternative syntax:
forget F remember R
Adds each dynfact in (
Dyn
) as a new last dynamic fact for its functor relation nameR
.R
must have been declared as dynamic.
act remember(dynfact)
The same as
remember
except thatDyn
is forgotten afterSecs
seconds.
act remember_for(dynfact, num)
Alternative syntax:
remember Dyn for Secs
Adds its ground relcall argument (
Dyn
) as a new first dynamic fact for its functor relation nameR
.R
must have been declared as a belief.
act rememberA(dynfact)
The same as
rememberA
except thatDyn
is forgotten afterSecs
seconds.
act remember_for(dynfact, num)
Alternative syntax:
rememberA Dyn for Secs
Remove the first dynamic fact matching each entry of
DynPtn
. Note thatDynptn
may contain variables within the arguments of each entry.forget
always succeeds even if there are no matching facts.
act forget(dyncall)
Here
Name
is an atom that must have been initialised with a statement
int Name:=Integer
, e.g.int count:=0
or
num Name:=Number
, e.g.num savings:=678.50
in the program. These statements are shorthand for
dyn
declarations and a definition using one fact of a unary relation calledName
. They are respectively expanded into:dyn Name(int) Name(Integer) dyn Name(num) Name(Number)The action
Name := Expression
is the same asforget Name(_) remember Name(Expression).
Name
can be used as though it were a global variable. To access its value the operator$
is applied. The expression$Name
evaluates to the currentint
ornum
value stored inName
, i.e. in the currentName
belief.
act :=(!rel(?num), !num), :=(!rel(?int), !int)
As above,
Name
is an atom that must have been initialised with a statement
int Name:=Integer
ornum Name:=Number
in the program.
The action
Name +:= Expression
is the same as
forget Name(Val) remember Name(Val+Expression)
.
act +:=(!rel(?num), !num), +:=(!rel(?int), !int)
Example use
count +:= 1
for increasing value held in
count
by 1.
As above,
Name
is an atom that must have been initialised with a statement
int Name:=Integer
ornum Name:=Number
in the program.
The action
Name -:= Expression
is the same as
forget Name(Val) remember Name(Val-Expression)
.
act -:=(!rel(?num), !num), -:=(!rel(?int), !int)
Example use
savings -:= 67.90
for decreasing the value held in
savings
by67.90
.
Next: TeleoR Specific Actions, Previous: Other Relations, Up: Built-Ins [Contents][Index]