orderWithStrategy

fun <E> Sequence<E>.orderWithStrategy(context: ExecutionContext, selectionStrategy: (Sequence<E>, ExecutionContext) -> E): Sequence<E>

Lazily reorders this sequence of candidates according to selectionStrategy: repeatedly asks selectionStrategy to pick one element out of what remains, yields it, then recurses on the rest -- so the first pick drives the order of the whole resulting sequence, one element at a time, without ever fully consuming the receiver upfront.

This is how it.unibo.tuprolog.solve.streams.SolverStrategies's predicationChoiceStrategy/ clauseChoiceStrategy are applied to a sequence of candidate predications/clauses during resolution.