Liking cljdoc? Tell your friends :D

wikla.tree

Behavior Tree branches, leaves and tools.

Behavior Tree branches, leaves and tools.
raw docstring

->dotclj

(->dot node file-name)

Eats node, saves tree to DOT file. (Uses spit -- Clojure only.)

Eats node, saves tree to DOT file. (Uses spit -- Clojure only.)
raw docstring

->pngclj

(->png node file-name)

Eats node, saves tree to PNG. (Shells out to dot -- Clojure only.)

Eats node, saves tree to PNG. (Shells out to dot -- Clojure only.)
raw docstring

->svgclj

(->svg node file-name)

Eats node, saves tree to SVG. (Shells out to dot -- Clojure only.)

Eats node, saves tree to SVG. (Shells out to dot -- Clojure only.)
raw docstring

actionclj/s

(action seed)

Create an Action node from given seed, which must at least contain :tick-fn.

Expectation regarding the tick-fn:

(tick-fn node) => node'
Create an Action node from given seed, which must at least
 contain :tick-fn.

Expectation regarding the tick-fn:

    (tick-fn node) => node'
raw docstring

Actionclj/s


as-parallelclj/s

(as-parallel coll)

Create a Parallel from collection of nodes.

Create a Parallel from collection of nodes.
raw docstring

as-robinclj/s

(as-robin coll)

Create a Robin from collection of nodes.

Create a Robin from collection of nodes.
raw docstring

as-selectorclj/s

(as-selector coll)

Create a Selector from collection of nodes.

Create a Selector from collection of nodes.
raw docstring

as-sequenceclj/s

(as-sequence coll)

Create a Sequence from collection of nodes.

Create a Sequence from collection of nodes.
raw docstring

attach-hookclj/s

(attach-hook node hook-fn)
(attach-hook node on-status hook-fn)

Attach hook on SUCCESS, FAILURE, RUNNING, READY or :* key.

Hook function should have the signature:

(hook-fn node') => nil
Attach hook on SUCCESS, FAILURE, RUNNING, READY or :* key.

Hook function should have the signature:

    (hook-fn node') => nil
raw docstring

conditionclj/s

(condition seed)

Create a Condition node from given seed, which must at least contain :pred-fn.

Expectation regarding the pred-fn:

(pred-fn node) => Boolean-ish
Create a Condition node from given seed, which must at least
 contain :pred-fn.

Expectation regarding the pred-fn:

    (pred-fn node) => Boolean-ish
raw docstring

Conditionclj/s


decided?clj/s

(decided? node)

Is node shifted to SUCCESS, FAILURE or RUNNING?

Is node shifted to SUCCESS, FAILURE or RUNNING?
raw docstring

decorateclj/s

(decorate child)

Decorate a child with default, pass-through Decorator.

Decorate a child with default, pass-through Decorator.
raw docstring

Decoratorclj/s


decoratorclj/s

(decorator seed)

Decorator is a hybrid node, defining both tick and part/join calls.

It holds a single child and decides if it should be executed: first tick is executed and calls:

(branch-pred decorator) => true | false

branch-pred returns true: child will be executed. Decorator changes its type to composite and signals Ready. During join child node is back and Decorator, it immediately runs post-join-fn:

(post-join-fn decorator) => decorator'

This function is fed Decorator containing ticked child, will decide final shape of the node. If post-join-fn is nil the decorator will just pass through flag and stash of the child.

branch-pred returns false: child is not used, own-tick-fn runs:

(own-tick-fn decorator) => decorator'

This constructor accepts a seed of:

  • child, a node to be decorated,
  • branch-pred used for branching? decision if first tick, defaut: yes,
  • own-tick-fn used to tick on decorator if branch-pred returned false, default: success,
  • post-join-fn used to tick after join of finalized child, default: nil,
  • flag preset, default: READY,
  • properties for the node, default: nil,
  • paramteres for the node, default: nil,
  • stash for the node, default: nil.

By default Decorator will try to execute the child and pass its status up. If forced to tick default own-tick will just succeed.

Callable expectations, stash and stashless:

(branch-pred decorator) => true | false

(post-join-fn decorator) => Success | Failure | Running | Ready

(own-tick-fn decorator) => Success | Failure | Running | Ready
Decorator is a hybrid node, defining both tick and part/join calls.

It holds a single child and decides if it should be executed: first tick
is executed and calls:

    (branch-pred decorator) => true | false

**branch-pred returns true:** child will be executed.
Decorator changes its type to composite and signals Ready. During join
child node is back and Decorator, it immediately runs post-join-fn:

    (post-join-fn decorator) => decorator'

This function is fed Decorator containing ticked child, will decide final
shape of the node. If post-join-fn is nil the decorator will just pass
through flag and stash of the child.

**branch-pred returns false:** child is not used, own-tick-fn runs:

    (own-tick-fn decorator) => decorator'

This constructor accepts a seed of:

* child, a node to be decorated,
* branch-pred used for branching? decision if first tick, defaut: yes,
* own-tick-fn used to tick on decorator if branch-pred returned false,
  default: success,
* post-join-fn used to tick after join of finalized child, default: nil,
* flag preset, default: READY,
* properties for the node, default: nil,
* paramteres for the node, default: nil,
* stash for the node, default: nil.

By default Decorator will try to execute the child and pass its status
up. If forced to tick default own-tick will just succeed.

Callable expectations, stash and stashless:

    (branch-pred decorator) => true | false

    (post-join-fn decorator) => Success | Failure | Running | Ready

    (own-tick-fn decorator) => Success | Failure | Running | Ready
raw docstring

detach-hookclj/s

(detach-hook node)
(detach-hook node on-status)

Detach hook on SUCCESS, FAILURE, RUNNING, READY or :* key.

Detach hook on SUCCESS, FAILURE, RUNNING, READY or :* key.
raw docstring

done?clj/s

(done? node)

Is node shifted to SUCCESS or FAILURE?

Is node shifted to SUCCESS or FAILURE?
raw docstring

dot-colorsclj/s


dot-stringclj/s

(dot-string node)

Eats node, returns DOT graph string.

Walks the tree Depth-First, numbers nodes and links them.

Eats node, returns DOT graph string.

Walks the tree Depth-First, numbers nodes and links them.
raw docstring

FAILUREclj/s


failureclj/s

(failure node)
(failure node stash)

Shift node to FAILURE. Optionally with stash.

Shift node to FAILURE. Optionally with stash.
raw docstring

failure-actionclj/s

Predefined Action that will fail on tick.

Predefined Action that will fail on tick.
raw docstring

failure-conditionclj/s

Predefined failing condition.

Predefined failing condition.
raw docstring

failure?clj/s

(failure? node)

Is node shifted to FAILURE?

Is node shifted to FAILURE?
raw docstring

fn->actionclj/s

(fn->action tick-fn)
(fn->action name tick-fn)

Create Action out of a tick-fn function.

Create Action out of a tick-fn function.
raw docstring

fn->conditionclj/s

(fn->condition pred-fn)
(fn->condition name pred-fn)

Create Condition out of a pred-fn function.

Create Condition out of a pred-fn function.
raw docstring

muclj/s

(mu & _)

Always nil, just like (constantly nil), except interned.

Always nil, just like (constantly nil), except interned.
raw docstring

noclj/s

(no & _)

Always false, just like (constantly false), except interned.

Always false, just like (constantly false), except interned.
raw docstring

Nodeclj/sprotocol

Branching and ticking, access and viz helpers, just node things.

Branching and ticking, access and viz helpers, just node things.

-node?clj/s

(-node? _)

Is this a Node?

Is this a Node?

dot-colorclj/s

(dot-color this)

Node color in the visualization.

Node color in the visualization.

dot-shapeclj/s

(dot-shape this)

Desired Shape in the visualization.

Desired Shape in the visualization.

joinclj/s

(join this child*)

Join current child.

Join current child.

shiftclj/s

(shift this)
(shift this flag*)

Get-set flag.

Get-set flag.

tickclj/s

(tick this)

Update node.

Update node.

branch?clj/s

(branch? this)

Is this a branch?

Is this a branch?

yieldclj/s

(yield this)
(yield this yield*)

Get-set stash.

Get-set stash.

hooksclj/s

(hooks this)
(hooks this hook*)

Get-set hooks.

Get-set hooks.

partclj/s

(part this)

Get next child.

Get next child.

paramsclj/s

(params this)
(params this params*)

Get-set parameters.

Get-set parameters.

branchesclj/s

(branches this)
(branches this children*)

Get-set children.

Get-set children.

labelclj/s

(label this)
(label this label*)

Get-set name.

Get-set name.

stemclj/s

(stem this)
(stem this stem*)

Get-set node.

Get-set node.

dot-labelclj/s

(dot-label this)

Node Description in the visualization.

Node Description in the visualization.
raw docstring

node-seqclj/s

(node-seq node)

Eat node, return seq.

Eat node, return seq.
raw docstring

node?clj/s

(node? o)

Is this a Node?

Is this a Node?
raw docstring

parallelclj/s

(parallel seed)

Create a Parallel node with given seed and nodes. Children will run in order, child that is RUNNING will be put in queue and Parallel will get READY to execute next child immediately. Parallel will itself return RUNNING on retry and full cycle, which can be changed.

When all children are either SUCCESS or FAILURE final tally will executes. If no threshold is reached, then fresh copy of children will be brought back for execution and Parallel will raise retry count and retry.

Parallel will evalute to, in order:

  • SUCCESS if all children are done and success-th was reached
  • FAILURE if all children are done and failure-th was reached
  • cycle-flag on cycle completion (all children ran once)
  • retry-flag on retry initiation.

If both success-th and failure-th were reached SUCCESS will be returned.

The rewind-fn is given Parallel to prepare it for re-run, defaults to nil, in which case fresh copy of children is used. The rewind-fn can overwrite retry-flag, which is set before that function runs.

For alternate Parallel implementation see: Robin.

Create a Parallel node with given seed and nodes. Children will
run in order, child that is RUNNING will be put in queue and Parallel will
get READY to execute next child immediately. Parallel will itself return
RUNNING on retry and full cycle, which can be changed.

When all children are either SUCCESS or FAILURE final tally will executes.
If no threshold is reached, then fresh copy of children will be brought
back for execution and Parallel will raise retry count and retry.

Parallel will evalute to, in order:

* SUCCESS if all children are done and success-th was reached
* FAILURE if all children are done and failure-th was reached
* cycle-flag on cycle completion (all children ran once)
* retry-flag on retry initiation.
 
If both success-th and failure-th were reached SUCCESS will be returned.

The rewind-fn is given Parallel to prepare it for re-run, defaults to nil,
in which case fresh copy of children is used. The rewind-fn can overwrite
retry-flag, which is set before that function runs.

For alternate Parallel implementation see: Robin.
raw docstring

Parallelclj/s


parallel*clj/s

(parallel* & nodes)

Create a Parallel from node arguments.

Create a Parallel from node arguments.
raw docstring

(print-callstack a-root)

Print callstack from given a Stepper implementing callstack.

Print callstack from given a Stepper implementing callstack.
raw docstring

(print-tree start-node)
(print-tree marker-pred start-node)

Print nodes of a tree, indented by depth, marked via predicate.

Print nodes of a tree, indented by depth, marked via predicate.
raw docstring

readyclj/s

(ready node)
(ready node stash)

Shift node to READY. Optionally with stash.

Shift node to READY. Optionally with stash.
raw docstring

READYclj/s


ready?clj/s

(ready? node)

Is node shifted to READY?

Is node shifted to READY?
raw docstring

Robinclj/s


robinclj/s

(robin seed)

Create a Robin node with given seed and nodes. Children will run in order, child that is RUNNING will be put in queue and Robin will get READY to execute next child immediately. Robin will be RUNNING on retry and cycle completion which can be customized.

When all children are either SUCCESS or FAILURE summary-fn will execute on Robin. If it returns SUCCESS or FAILURE then Robin ends its run with that. If it returns RUNNING Robin will retry.

Robin will evalute to:

  • SUCCESS if all children are done and summary-fn sets SUCCESS
  • FAILURE if all children are done and summary-fn sets FAILURE
  • cycle-flag on cycle completion (all children ran once)
  • retry-flag on retry initiation.

If no summary-fn is provided Robin returns SUCCESS once all children are done.

The rewind-fn is given Robin to prepare it for re-run, defaults to nil, in which case fresh copy of children is used. The rewind-fn is able to overwrite retry-flag, because that is set before it runs.

Robin is a non-canon Parallel implementation.

Create a Robin node with given seed and nodes. Children will run in order,
child that is RUNNING will be put in queue and Robin will get READY
to execute next child immediately. Robin will be RUNNING on retry and cycle
completion which can be customized.

When all children are either SUCCESS or FAILURE summary-fn will execute
on Robin. If it returns SUCCESS or FAILURE then Robin ends its run with
that. If it returns RUNNING Robin will retry.

Robin will evalute to:

* SUCCESS if all children are done and summary-fn sets SUCCESS
* FAILURE if all children are done and summary-fn sets FAILURE
* cycle-flag on cycle completion (all children ran once)
* retry-flag on retry initiation.

If no summary-fn is provided Robin returns SUCCESS once all children
are done.

The rewind-fn is given Robin to prepare it for re-run, defaults to nil,
in which case fresh copy of children is used. The rewind-fn is able
to overwrite retry-flag, because that is set before it runs.

Robin is a non-canon Parallel implementation.
raw docstring

robin*clj/s

(robin* & nodes)

Create a Robin from node arguments.

Create a Robin from node arguments.
raw docstring

Rootclj/s


rootclj/s

(root seed)

Create Root node with given seed and tree.

Create Root node with given seed and tree.
raw docstring

root-ofclj/s

(root-of tree)

Create Root node with given tree node.

Create Root node with given tree node.
raw docstring

run-hooks!clj/s

(run-hooks! node)

Try to execute hooks for side-effects, return node.

Try to execute hooks for side-effects, return node.
raw docstring

runningclj/s

(running node)
(running node stash)

Shift node to RUNNING. Optionally with stash.

Shift node to RUNNING. Optionally with stash.
raw docstring

RUNNINGclj/s


running-actionclj/s

Predefined Action that will be running on tick.

Predefined Action that will be running on tick.
raw docstring

running?clj/s

(running? node)

Is node shifted to RUNNING?

Is node shifted to RUNNING?
raw docstring

Selectorclj/s


selectorclj/s

(selector seed)

Create a Selector node from given seed, which must at least contain :children.

Sequence will evalute to:

  • SUCCESS if a child returns SUCCESS.
  • FAILURE if all children ran and resulted in FAILURE.
  • RUNNING immediately if any child is RUNNING.
Create a Selector node from given seed, which must at least
 contain :children.

Sequence will evalute to:

* SUCCESS if a child returns SUCCESS.
* FAILURE if all children ran and resulted in FAILURE.
* RUNNING immediately if any child is RUNNING.
raw docstring

selector*clj/s

(selector* & nodes)

Create a Selector from node arguments.

Create a Selector from node arguments.
raw docstring

Sequenceclj/s


sequenceclj/s

(sequence seed)

Create a Sequence node from given seed which must at least contain :children.

Sequence will evalute to:

  • SUCCESS if all children ran and were SUCCESS.
  • FAILURE immediately if any child is FAILURE.
  • RUNNING immediately if any child is RUNNING.
Create a Sequence node from given seed which must at least
 contain :children.

Sequence will evalute to:

* SUCCESS if all children ran and were SUCCESS.
* FAILURE immediately if any child is FAILURE.
* RUNNING immediately if any child is RUNNING.
raw docstring

sequence*clj/s

(sequence* & nodes)

Create a Sequence from node arguments.

Create a Sequence from node arguments.
raw docstring

Stepperclj/sprotocol

Step-by-step ticking.

Step-by-step ticking.

-stepper?clj/s

(-stepper? this)

Is this a Stepper?

Is this a Stepper?

callstackclj/s

(callstack this)

Return full stack from root to current node.

Return full stack from root to current node.

exhaustclj/s

(exhaust this)

Step through tree until finished.

Step through tree until finished.

finished?clj/s

(finished? this)

Is this tick completed?.

Is this tick completed?.

handle-branchclj/s

(handle-branch this)

Perform branch op.

Perform branch op.

handle-leafclj/s

(handle-leaf this)

Perform leaf op.

Perform leaf op.

stepclj/s

(step this)

Perform single op.

Perform single op.

step-untilclj/s

(step-until this pred)

Perform steps until predicate is true.

Perform steps until predicate is true.
raw docstring

stepper?clj/s

(stepper? o)

Is this a Stepper?

Is this a Stepper?
raw docstring

successclj/s

(success node)
(success node stash)

Shift node to SUCCESS. Optionally with stash.

Shift node to SUCCESS. Optionally with stash.
raw docstring

SUCCESSclj/s


success-actionclj/s

Predefined Action that will succeed on tick.

Predefined Action that will succeed on tick.
raw docstring

success-conditionclj/s

Predefined succeeding condition.

Predefined succeeding condition.
raw docstring

success?clj/s

(success? node)

Is node shifted to SUCCESS?

Is node shifted to SUCCESS?
raw docstring

to-failureclj/s

(to-failure a-fn)

Create an Action that runs given function on stash and fails.

Create an Action that runs given function on stash and fails.
raw docstring

to-successclj/s

(to-success a-fn)

Create an Action that runs given function on stash and succeeds.

Create an Action that runs given function on stash and succeeds.
raw docstring

via-predclj/s

(via-pred pred)

Create a Condition that runs given predicate on stash.

Create a Condition that runs given predicate on stash.
raw docstring

yesclj/s

(yes & _)

Always true, just like (constantly true), except interned.

Always true, just like (constantly true), except interned.
raw docstring

zipperclj/s

(zipper node)

Eat node, return zipper.

Eat node, return zipper.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close