@@ -15,18 +15,18 @@ before emitting `n` values.
1515
1616This function requires a `Productive` instance proving that the iterator will always emit a value
1717after a finite number of skips. If the iterator is not productive or such an instance is not
18- available, consider using `it.allowNontermination.seekIdx ?` instead of `it.seekIdx ?`. However, it is
19- not possible to formally verify the behavior of the partial variant.
18+ available, consider using `it.allowNontermination.atIdxSlow ?` instead of `it.atIdxSlow ?`. However,
19+ it is not possible to formally verify the behavior of the partial variant.
2020-/
2121@[specialize]
22- def Iter.seekIdx ? {α β} [Iterator α Id β] [Productive α Id]
22+ def Iter.atIdxSlow ? {α β} [Iterator α Id β] [Productive α Id]
2323 (n : Nat) (it : Iter (α := α) β) : Option β :=
2424 match it.step with
2525 | .yield it' out _ =>
2626 match n with
2727 | 0 => some out
28- | k + 1 => it'.seekIdx ? k
29- | .skip it' _ => it'.seekIdx ? n
28+ | k + 1 => it'.atIdxSlow ? k
29+ | .skip it' _ => it'.atIdxSlow ? n
3030 | .done _ => none
3131termination_by (n, it.finitelyManySkips)
3232
@@ -36,17 +36,17 @@ returns the `n`-th emitted value, or `none` if `it` finished
3636before emitting `n` values.
3737
3838This is a partial, potentially nonterminating, function. It is not possible to formally verify
39- its behavior. If the iterator has a `Productive` instance, consider using `Iter.seekIdx ?` instead.
39+ its behavior. If the iterator has a `Productive` instance, consider using `Iter.atIdxSlow ?` instead.
4040-/
4141@[specialize]
42- partial def Iter.Partial.seekIdx ? {α β} [Iterator α Id β] [Monad Id]
42+ partial def Iter.Partial.atIdxSlow ? {α β} [Iterator α Id β] [Monad Id]
4343 (n : Nat) (it : Iter.Partial (α := α) β) : Option β := do
4444 match it.it.step with
4545 | .yield it' out _ =>
4646 match n with
4747 | 0 => some out
48- | k + 1 => (⟨it'⟩ : Iter.Partial (α := α) β).seekIdx ? k
49- | .skip it' _ => (⟨it'⟩ : Iter.Partial (α := α) β).seekIdx ? n
48+ | k + 1 => (⟨it'⟩ : Iter.Partial (α := α) β).atIdxSlow ? k
49+ | .skip it' _ => (⟨it'⟩ : Iter.Partial (α := α) β).atIdxSlow ? n
5050 | .done _ => none
5151
5252end Std.Iterators
0 commit comments