A single fact condition, e.g. {:order, id, amt}, %Order{id: id} or
f = {:order, id} when amt > 0.
Fields are typed by t/0. Three are not obvious:
:fact_bindingis not part of:bind, because the alpha does not return it. The engine adds it when it builds a token.:bindexcludes_-prefixed names, pinned values and module attributes.:join_filter,:join_bindand:new_bindarenilafter parsing.Rete.DSL.Bindingsfills them in. Seedocs/design/ir.md§2.
Summary
Types
@type ast() :: %{ pattern: Macro.t(), guard: Macro.t() | nil, bind: %{required(atom()) => Macro.t()}, source: Macro.t() }
Raw quoted fragments kept for the later phases: the pattern as written without the
fact binding or the when guard, the guard AST or nil, the variable AST of every
entry of :bind, and the whole element as written for error messages.
@type t() :: %Rete.IR.Fact{ __ast__: ast() | nil, alpha: Rete.IR.Expr.t(), bind: [atom()], fact_binding: atom() | nil, join_bind: [atom()] | nil, join_filter: Rete.IR.Expr.t() | nil, new_bind: [atom()] | nil, type: atom() | module() }