View Source Guesswork.Constraint.Arithmetic (Guesswork v0.8.0)

A constraint that represents basic integer arithmetic.

Summary

Functions

Builds a new arithmetic constraint from an elixir expression.

Takes an elixir polynomial expression that contains exactly one =, simplifies, and returns a logical statement.

Types

operation()

@type operation() :: :* | :+ | :-

opts_list()

@type opts_list() :: [{:halt_on_error, term()}]

t()

@type t() :: %Guesswork.Constraint.Arithmetic{
  a: value(),
  b: value(),
  c: value(),
  constraint: Guesswork.Constraint.Comparison.constraint(),
  negated: boolean(),
  operation: operation()
}

value()

@type value() :: integer() | Guesswork.Ast.Variable.t()

Functions

add(r1, r2)

build_fn(atom, bool)

divide(x, y)

multiply(x, y)

new(expr, opts \\ [])

(macro)

Builds a new arithmetic constraint from an elixir expression.

The following fields are available:

  • :halt_on_error (term/0) - Indicates that, should this constraint produce a value that disagrees with the answer set or is invalid, Guesswork should stop searching. The default value is false.

new(a, operation, b, constraint, c, negated)

Takes an elixir polynomial expression that contains exactly one =, simplifies, and returns a logical statement.

subtract(r1, r2)