View Source Guesswork.Answer.Binding (Guesswork v0.4.4)
A 'bound' entity, that is a possible values (notted or exact) and computations, connected to a variable.
Summary
Functions
Applies the env to any computations stored in the binding. If any results disagree, the action fails and nil is returned. Any incomplete computation is ignored.
Takes two bindings and attempts to merge them. Any disagreement between the two will result in failure.
Turns the binding into a simple variable, result pair.
Types
@type t() :: %Guesswork.Answer.Binding{ computations: [{Guesswork.Answer.Computation.t(), boolean()}], value: value(), variable_display: String.t() }
@type value() :: {:bound, Guesswork.Ast.Term.entity()} | {:not, [Guesswork.Ast.Term.entity()]} | :unbound
Functions
@spec add_computation(t(), Guesswork.Answer.Computation.t(), boolean()) :: t()
@spec apply(t(), Guesswork.Ast.Statement.env(), String.t()) :: t() | nil
Applies the env to any computations stored in the binding. If any results disagree, the action fails and nil is returned. Any incomplete computation is ignored.
Takes two bindings and attempts to merge them. Any disagreement between the two will result in failure.
@spec new( String.t(), Guesswork.Ast.Term.entity() | Guesswork.Answer.Computation.t(), boolean() ) :: t()
Turns the binding into a simple variable, result pair.