Wraps a DSL function in a struct that manages currying of the arguments
which are fed in one at a time through .apply(). Example: the “+” primitive
evaluates to a CurriedFn with arity 2 and empty partial_args. The expression
(app + 3) evals to a CurriedFn with vec![3] as the partial_args. The expression
(app (app + 3) 4) will evaluate to 7 (since .apply() will fill the last argument,
notice that all arguments are filled, and return the result).
An untyped lambda calculus expression, much like egg::RecExpr but with a public nodes field
and many attached functions. See Lambda for details on the individual nodes.
A single term in an flattened explanation.
After the first term in a FlatExplanation, each term
will be annotated with exactly one backward_rule or one
forward_rule. This can appear in children FlatTerms,
indicating that the child is being rewritten.
A generic error for failing to parse an operator. This is the error type
used by define_language! for FromOp::Error, and is a sensible choice
when implementing FromOp manually.
An explanation for a term and its equivalent children.
Each child is a proof transforming the initial child into the final child term.
The initial term is given by taking each first sub-term
in each child_proofs recursivly.
The final term is given by all of the final terms in each child_proofs.
A node of an untyped lambda calculus expression compatible with egg but also used more widely throughout this crate.
Note that there is no domain associated with this object. This makes it easy to run compression on
domains that don’t have semantics yet, makes it easy to add new prims (eg learned functions), etc.
You’ll have to specify a domain when you execute the expression, type check it, etc, but you can easily do
that at the time through generics on those functions.
a value can either be some domain specific value Dom(D) like an Int,
or it can be a primitive function or partially applied primitive function like + or (+ 2)
or it can be a lambda function with some captured env like (lam (* $1 $0)) where $1 may have been captured from
the surrounding code and this whole object may now be passed around
FlatExplanation are the simpler, expanded representation
showing one term being rewritten to another.
Each step contains a full FlatTerm. Each flat term
is connected to the previous by exactly one rewrite.