View Source Guesswork.Ast.Precomputed (Guesswork v0.5.0)
Tooling that allows fact arguments that have the same matches and substitusions to be grouped, precomputed, and shuffled, removing duplicated work.
Summary
Functions
Takes a precalculated list of answers and the remaining stream and combines them into a single calculation.
Takes a precalculated list of answers and the remaining stream from another fact
with the same concrete arguments but different variables, and a variable
subsitution map, then combines them into a single calculation that also uses
Guesswork.Answer.substitue_variables/2
to set the answer set to the original
variables used in the original fact.
Takes a list of statements, and the arguments needed to resolve them and then combines resolves them into streams, precomputing any groupable facts.
Types
@type grouping_key() :: {String.t(), [Guesswork.Ast.Term.entity() | nil]}
Functions
@spec resolve([Guesswork.Answer.t()], Enumerable.t(Guesswork.Answer.t())) :: Enumerable.t(Guesswork.Answer.t())
Takes a precalculated list of answers and the remaining stream and combines them into a single calculation.
@spec resolve([Guesswork.Answer.t()], Enumerable.t(Guesswork.Answer.t()), %{ required(String.t()) => Guesswork.Ast.Variable.t() }) :: Enumerable.t(Guesswork.Answer.t())
Takes a precalculated list of answers and the remaining stream from another fact
with the same concrete arguments but different variables, and a variable
subsitution map, then combines them into a single calculation that also uses
Guesswork.Answer.substitue_variables/2
to set the answer set to the original
variables used in the original fact.
@spec resolve_args( [Guesswork.Ast.Statement.t()], boolean(), Guesswork.Ast.Statement.Opts.t() ) :: [ Enumerable.t(Guesswork.Answer.t()) ]
Takes a list of statements, and the arguments needed to resolve them and then combines resolves them into streams, precomputing any groupable facts.