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

Link to this function

resolve(calculated, remaining)

View Source

Takes a precalculated list of answers and the remaining stream and combines them into a single calculation.

Link to this function

resolve(calculated, remaining, substitutions)

View Source

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.

Link to this function

resolve_args(args, negated, opts)

View Source

Takes a list of statements, and the arguments needed to resolve them and then combines resolves them into streams, precomputing any groupable facts.