View Source Guesswork.Answer (Guesswork v0.8.0)
Answers are maps of variable id to bindings as well as any tests that must be checked.
Summary
Functions
Takes an answer set and removes any binding not passed to the function.
Takes an answer set and removes any constraint with inputs not passed to the function.
Extracts the displayable information from the answer set, returning a simple map.
Pulls all bound, concrete values from the answer set.
Removes all internal variables that are not currently in use by the constraint store.
Removes all constraints for which the inputs are in the bindings. No constraints are resolved, only removed.
Resolves both tests and computations as well as checking if the stop conditions have been met and the answer stream should halt.
Replaces all bound variables using the variable id to variable map.
Takes an answer and traverses all entities, looking for specific solutions.
Takes an answer and traverses the entities stored in the supplied variables, looking for specific solutions.
Takes two answer sets and attempts to take the union of them. If any variables point to contradicting values the process will fail and return nil.
Types
@type bindings() :: %{required(String.t()) => Guesswork.Answer.Binding.t()}
@type t() :: %Guesswork.Answer{ bindings: bindings(), constraints: Guesswork.Constraint.Store.t(), query_id: String.t() | nil }
Functions
Takes an answer set and removes any binding not passed to the function.
:halt
s are passed through to facilitate stop conditions.
@spec filter_constraints(t() | :halt, MapSet.t(Guesswork.Ast.Variable.t())) :: t() | :halt
Takes an answer set and removes any constraint with inputs not passed to the function.
:halt
s are passed through to facilitate stop conditions.
@spec flatten(t()) :: %{required(String.t()) => Guesswork.Answer.Result.value()}
Extracts the displayable information from the answer set, returning a simple map.
@spec get_env(t()) :: Guesswork.Ast.Statement.env()
Pulls all bound, concrete values from the answer set.
@spec put_binding( t(), Guesswork.Ast.Variable.t(), Guesswork.Ast.Entity.t(), boolean() ) :: {:ok, t()} | :error
@spec put_constraint(t(), Guesswork.Constraint.t(), boolean()) :: t()
Removes all internal variables that are not currently in use by the constraint store.
Removes all constraints for which the inputs are in the bindings. No constraints are resolved, only removed.
Resolves both tests and computations as well as checking if the stop conditions have been met and the answer stream should halt.
:halt
s are passed through to facilitate stop conditions.
@spec resolve_constraints(t(), Guesswork.Ast.Statement.env()) :: t() | nil | :halt
@spec substitue_variables(t() | :halt, %{ required(String.t()) => Guesswork.Ast.Variable.t() }) :: t() | :halt
Replaces all bound variables using the variable id to variable map.
:halt
s are passed through to facilitate stop conditions.
@spec traverse_entities(t()) :: Enumerable.t(t())
Takes an answer and traverses all entities, looking for specific solutions.
Note that this is very similar to labeling.
@spec traverse_entities(t(), MapSet.t(String.t())) :: Enumerable.t(t())
Takes an answer and traverses the entities stored in the supplied variables, looking for specific solutions.
Note that this is very similar to labeling.
Takes two answer sets and attempts to take the union of them. If any variables point to contradicting values the process will fail and return nil.
:halt
s are passed through to facilitate stop conditions.