A partial match travelling down the beta network: what a rule has established so far.
Internal, but its fields reach you through Rete.Listener events. Read them
freely. Do not depend on its functions.
:matches—[{fact, node_id}], in match order. Order is part of the token's identity. Two tokens over the same facts in a different order are different matches.:bindings—%{name => value}, the variables bound so far.
The engine compares tokens by value. This is what makes retraction work, even when the fact that caused it is a different term with the same value.
Summary
Functions
Extends a token with one more matched fact and the bindings it contributed.
The facts behind a token, in match order.
The subset of a token's bindings used as a join key.
Types
Functions
Extends a token with one more matched fact and the bindings it contributed.
iex> Rete.Token.extend(%Rete.Token{}, {:order, 1}, :n3, %{cid: 1})
%Rete.Token{matches: [{{:order, 1}, :n3}], bindings: %{cid: 1}}
The facts behind a token, in match order.
iex> token = %Rete.Token{matches: [{{:customer, 1}, :n1}, {{:order, 1, 250}, :n3}]}
iex> Rete.Token.facts(token)
[{:customer, 1}, {:order, 1, 250}]
The subset of a token's bindings used as a join key.
iex> token = %Rete.Token{bindings: %{cid: 1, amt: 5}}
iex> Rete.Token.join_key(token, [:cid])
%{cid: 1}