View Source Guesswork.Answer.PartiallyEvaluated (Guesswork v0.8.0)
Represents a partially evaluated enumerable of answers, allowing the answer sets to be handled one at a time.
Summary
Functions
Checks if the stream has been fully consumed
If possible, takes the first item in the stream and evaluates it. Otherwise marks the value as done.
Takes a list of partial evaluations and attempts to calculate the next set of unioned answer sets, based on the next evaluated answer set unioned with the previously evaluated answer sets.
Types
@type t() :: %Guesswork.Answer.PartiallyEvaluated{ done?: boolean(), evaluated: [Guesswork.Answer.t()], evaluated_count: integer(), stream: Enumerable.t(Guesswork.Answer.t()) }
@type unions_result() :: :empty | :done | {:ok, [t()], [Guesswork.Answer.t() | :halt]}
Functions
@spec count_unions(unions_result()) :: non_neg_integer()
Checks if the stream has been fully consumed
If possible, takes the first item in the stream and evaluates it. Otherwise marks the value as done.
@spec new(Enumerable.t(Guesswork.Answer.t())) :: t()
@spec next_unions([t()]) :: unions_result()
Takes a list of partial evaluations and attempts to calculate the next set of unioned answer sets, based on the next evaluated answer set unioned with the previously evaluated answer sets.
The returned unions can either result in an answer set, or a :halt
, which
indicates that a stop condition has been met and that stream should stop.