Arithmetic constraint implementation for the Constraint behaviour.
Evaluates arithmetic constraints (:add, :sub, :mul, :div) which
bind a result variable. All arithmetic is integer-only. Division by zero
filters the binding.
This module is the canonical evaluator for arithmetic operations. It is
dispatched to by ExDatalog.Constraint.evaluate/3 when the constraint's
op is :add, :sub, :mul, or :div.
Summary
Functions
Evaluates an arithmetic constraint against a binding environment.
Functions
@spec evaluate( ExDatalog.IR.Constraint.t(), ExDatalog.Engine.Binding.t(), ExDatalog.Constraint.Context.t() ) :: {:ok, ExDatalog.Engine.Binding.t()} | :filter
Evaluates an arithmetic constraint against a binding environment.
Accepts an IR.Constraint struct as produced by the compiler. Returns
{:ok, extended_binding} when the arithmetic succeeds (result variable
is bound), or :filter when division by zero occurs or an input variable
is unbound.