View Source Guesswork.Answer.Binding (Guesswork v0.8.0)
A 'bound' entity, that is a possible values (notted or exact) and computations, connected to a variable.
Summary
Functions
Takes two bindings and attempts to merge them. Any disagreement between the two will result in failure.
Types
@type t() :: %Guesswork.Answer.Binding{value: value()}
@type value() :: {:bound, Guesswork.Ast.Entity.t()} | {:not, [Guesswork.Ast.Entity.t()]}
Functions
@spec get_result_value(t()) :: Guesswork.Answer.Result.value()
Takes two bindings and attempts to merge them. Any disagreement between the two will result in failure.
Examples
iex> four = Guesswork.Answer.Binding.new(4, false)
...> Guesswork.Answer.Binding.merge(four, four)
four
iex> five = Guesswork.Answer.Binding.new(5, false)
...> Guesswork.Answer.Binding.merge(four, five)
nil
iex> not_five = Guesswork.Answer.Binding.new(5, true)
...> Guesswork.Answer.Binding.merge(four, not_five)
four
iex> not_four = Guesswork.Answer.Binding.new(4, true)
...> Guesswork.Answer.Binding.merge(not_four, not_five)
%Guesswork.Answer.Binding{value: {:not, [4, 5]}}
@spec new(Guesswork.Ast.Entity.t(), boolean()) :: t()