ExDatalog.Constraints.Comparison (ExDatalog v0.2.0)

Copy Markdown View Source

Comparison constraint implementation for the Constraint behaviour.

Evaluates comparison constraints (:gt, :lt, :gte, :lte, :eq, :neq) which filter bindings without introducing new variable bindings.

This module is the canonical evaluator for comparison operations. It is dispatched to by ExDatalog.Constraint.evaluate/3 when the constraint's op is one of the comparison operators.

Summary

Functions

Evaluates a comparison constraint against a binding environment.

Functions

evaluate(constraint, binding, context)

Evaluates a comparison constraint against a binding environment.

Accepts an IR.Constraint struct as produced by the compiler. Returns {:ok, binding} (unchanged) when the comparison succeeds, or :filter when it fails or an input variable is unbound.