precept.listeners

all-listeners

(all-listeners session)

Returns all listener instances or empty list if none.

append-trace

(append-trace listener event)

Appends a trace event and returns a new listener with it.

check-retract-facts-logical-failure

(check-retract-facts-logical-failure facts)

create-devtools-listeners

(create-devtools-listeners ch *event-coords initial-trace)

Returns Clara DelegatingListener that sends listener events through a PersistentFactListener and PersistentSessionEventMessanger constructed with the supplied arguments. - initial-trace - vector or nil. Passed to fact listener. Defaults to []. - `ch - core.async channel that PersistentSessionEventMessenger will put events to ` *event-coords - atom with keys :event-number, :state-number, :state-id. :event-number updated within SessionEventMessenger methods.

create-fact-listener

(create-fact-listener)(create-fact-listener initial-trace)

deconstruct-node-token

(deconstruct-node-token node token)

diff-ops

(diff-ops ops)

Returns net result of session changes in order to eliminate ordinal significance of add/remove mutations to view-model

explain-insert-facts

(explain-insert-facts node token facts)

fact-traces

(fact-traces session)

Returns [[]…]. List of fact events for each fact listener in the session.

get-fact-match-or-matches

(get-fact-match-or-matches matches)

handle-event!

(handle-event! ch *event-coords type node token facts)

insertions

(insertions trace-by-type)

list-facts

(list-facts xs)

ops

(ops session)

Returns :added, :removed results. Assumes a single fact listener in the vector of session’s :listeners that may be a child of a PersistentDelegatingListener.

replace-listener

(replace-listener session)(replace-listener session listener)

Removes and adds listener(s) from session. When called with session only adds PersistentFactListener with initial state of [].

retractions

(retractions trace-by-type)

split-matches-and-tokens

(split-matches-and-tokens matches)

Splits matches into vector of facts, tokens

split-ops

(split-ops trace)

Takes trace returned by Clara’s get-trace. Returns m of :added, :removed

to-transient-fact-listener

(to-transient-fact-listener listener)

to-transient-session-event-messenger

(to-transient-session-event-messenger listener)

trace-by-type

(trace-by-type trace)

vec-ops

(vec-ops session)

Takes a session with a FactListener and returns the result of the trace as {:added [vector tuples] :removed [vector tuples]}

vectorize-trace

(vectorize-trace trace)