Documentation

Init.Data.Range.Polymorphic.RangeIterator

Range iterator #

This module implements an iterator for ranges (such as Std.Rcc).

This iterator is publicly available via Std.Rcc.iter (and identically named functions in the sibling namespaces) after importing Std.Data.Iterators.

It powers many functions on ranges internally, such as Rcc.toList.

@[unbox]
structure Std.Rxc.Iterator (α : Type u) :

Internal state of the range iterators. Do not depend on its internals.

  • next : Option α
  • upperBound : α
Instances For
    @[inline]

    The pure function mapping a range iterator of type IterM to the next step of the iterator.

    This function is prefixed with Monadic in order to disambiguate it from the version for iterators of type Iter.

    Instances For
      @[inline]
      def Std.Rxc.Iterator.step {α : Type u} [PRange.UpwardEnumerable α] [LE α] [DecidableLE α] (it : Iter α) :
      IterStep (Iter α) α

      The pure function mapping a range iterator of type Iter to the next step of the iterator.

      Instances For
        theorem Std.Rxc.Iterator.isPlausibleStep_iff {α : Type u} [PRange.UpwardEnumerable α] [LE α] [DecidableLE α] {it : Iter α} {step : IterStep (Iter α) α} :
        @[instance_reducible, inline]

        An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

        @[inline]
        def Std.Rxc.Iterator.instIteratorLoop.loop {α : Type u} [PRange.UpwardEnumerable α] [LE α] [DecidableLE α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] {n : Type u → Type w} [Monad n] (γ : Type u) (Pl : α → γ → ForInStep γ → Prop) (LargeEnough : α → Prop) (hl : ∀ (a b : α), a ≤ b → LargeEnough a → LargeEnough b) (upperBound : α) (acc : γ) (next : α) (h : LargeEnough next) (f : (out : α) → LargeEnough out → out ≤ upperBound → (c : γ) → n (Subtype (Pl out c))) :
        n γ
        Instances For
          @[unbox]
          structure Std.Rxo.Iterator (α : Type u) :

          Internal state of the range iterators. Do not depend on its internals.

          • next : Option α
          • upperBound : α
          Instances For
            @[implicit_reducible, inline]

            The pure function mapping a range iterator of type IterM to the next step of the iterator.

            This function is prefixed with Monadic in order to disambiguate it from the version for iterators of type Iter.

            Instances For
              @[inline]
              def Std.Rxo.Iterator.step {α : Type u} [PRange.UpwardEnumerable α] [LT α] [DecidableLT α] (it : Iter α) :
              IterStep (Iter α) α

              The pure function mapping a range iterator of type Iter to the next step of the iterator.

              Instances For
                theorem Std.Rxo.Iterator.isPlausibleStep_iff {α : Type u} [PRange.UpwardEnumerable α] [LT α] [DecidableLT α] {it : Iter α} {step : IterStep (Iter α) α} :
                @[instance_reducible, inline]

                An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

                @[inline]
                def Std.Rxo.Iterator.instIteratorLoop.loop {α : Type u} [PRange.UpwardEnumerable α] [LT α] [DecidableLT α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (Pl : α → γ → ForInStep γ → Prop) (LargeEnough : α → Prop) (hl : ∀ (a b : α), PRange.UpwardEnumerable.LE a b → LargeEnough a → LargeEnough b) (upperBound : α) (acc : γ) (next : α) (h : LargeEnough next) (f : (out : α) → LargeEnough out → out < upperBound → (c : γ) → n (Subtype (Pl out c))) :
                n γ
                Instances For
                  @[unbox]
                  structure Std.Rxi.Iterator (α : Type u) :

                  Internal state of the range iterators. Do not depend on its internals.

                  Instances For
                    @[inline]

                    The pure function mapping a range iterator of type IterM to the next step of the iterator.

                    This function is prefixed with Monadic in order to disambiguate it from the version for iterators of type Iter.

                    Instances For
                      @[inline]

                      The pure function mapping a range iterator of type Iter to the next step of the iterator.

                      Instances For
                        @[instance_reducible, inline]

                        An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

                        @[inline]
                        def Std.Rxi.Iterator.instIteratorLoop.loop {α : Type u} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (Pl : α → γ → ForInStep γ → Prop) (LargeEnough : α → Prop) (hl : ∀ (a b : α), PRange.UpwardEnumerable.LE a b → LargeEnough a → LargeEnough b) (acc : γ) (next : α) (h : LargeEnough next) (f : (out : α) → LargeEnough out → (c : γ) → n (Subtype (Pl out c))) :
                        n γ
                        Instances For