ExDatalog.Constraints.Membership (ExDatalog v0.2.0)

Copy Markdown View Source

Membership constraint implementation for the Constraint behaviour.

Evaluates membership constraints (:member) which filter bindings based on whether a value is present in a constant list. The left operand must be bound; the right operand must be a constant list. Returns :filter when the value is not in the list or the left variable is unbound.

Summary

Functions

Evaluates a membership constraint against a binding environment.

Functions

evaluate(constraint, binding, context)

Evaluates a membership constraint against a binding environment.

Accepts an IR.Constraint struct as produced by the compiler. Returns {:ok, binding} (unchanged) when the left value is a member of the right list, or :filter when it is not or the left variable is unbound.