View Source Guesswork.Answer.PartiallyEvaluated (Guesswork v0.5.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())
}

Functions

Link to this function

done?(partially_evaluated)

View Source
@spec done?(t()) :: boolean()

Checks if the stream has been fully consumed

Link to this function

evaluated_count(partially_evaluated)

View Source
@spec evaluated_count(t()) :: integer()
@spec head(t()) :: t()

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()]) :: :empty | :done | {:ok, [t()], [Guesswork.Answer.t()]}

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.