Documentation

Strata.Util.ListMaps

@[reducible, inline]
abbrev Maps (α : Type u) (β : Type v) :
Type (max v u)
Equations
Instances For
    @[implicit_reducible]
    instance instInhabitedMaps {α : Type u_1} {β : Type u_2} :
    Inhabited (Maps α β)
    Equations
    @[implicit_reducible]
    instance instToFormatMapsOfMap {α : Type u_1} {β : Type u_2} [Std.ToFormat (Map α β)] :
    Equations
    def Maps.keys {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
    List α
    Equations
    Instances For
      def Maps.values {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
      List β
      Equations
      Instances For
        def Maps.isEmpty {α : Type u_1} {β : Type u_2} (m : Maps α β) :
        Equations
        Instances For
          def Maps.push {α : Type u_1} {β : Type u_2} (ms : Maps α β) (m : Map α β) :
          Maps α β

          Add Map m to the beginning of Maps ms.

          Equations
          Instances For
            def Maps.pop {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
            Maps α β

            Remove the newest Map in ms. Do nothing if ms is empty.

            Equations
            Instances For
              def Maps.oldest {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
              Map α β

              Get the oldest map (i.e., from the end) in ms.

              Equations
              Instances For
                def Maps.dropOldest {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
                Maps α β

                Drop the oldest map in ms.

                Equations
                Instances For
                  def Maps.newest {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
                  Map α β

                  Get the newest map (i.e., from the beginning) in ms.

                  Equations
                  Instances For
                    def Maps.addInNewest {α : Type u_1} {β : Type u_2} (ms : Maps α β) (m : Map α β) :
                    Maps α β

                    Append m to the end of the newest map in ms.

                    Equations
                    Instances For
                      def Maps.toSingleMap {α : Type u_1} {β : Type u_2} (ms : Maps α β) :
                      Map α β

                      Flatten the Maps ms to get a single map.

                      Searching for (x : α) after flattening will proceed from the newest to the oldest Map.

                      Equations
                      Instances For
                        def Maps.find? {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (x : α) :

                        Look up (x : α) in all the maps in ms.

                        Equations
                        Instances For
                          def Maps.findD {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (x : α) (d : β) :
                          β

                          Look up (x : α) in all the maps in ms, returning the default element d if x is not found.

                          Equations
                          Instances For
                            def Maps.remove {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (x : α) :
                            Maps α β

                            Remove x and its associated value from ms.

                            Equations
                            Instances For
                              def Maps.update {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (x : α) (v : β) :
                              Maps α β

                              Update x with v in ms. Do nothing if x is not in ms.

                              Equations
                              Instances For
                                def Maps.insert {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (x : α) (v : β) :
                                Maps α β

                                Insert (x, v) in ms. If x is already in ms, update that entry. Else add it to the most recent map.

                                Equations
                                Instances For
                                  def Maps.insertInOldest {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (x : α) (v : β) :
                                  Maps α β

                                  Insert (x, v) in the oldest map in ms. Do nothing if x is already in ms.

                                  Equations
                                  Instances For
                                    def Maps.addInOldest {α : Type u_1} {β : Type u_2} [DecidableEq α] (ms : Maps α β) (xs : List α) (vs : List β) :
                                    Maps α β

                                    Insert (xi, vi) -- where xi and vi are corresponding elements of xs and vs -- in the oldest map in ms, only if xi is not in ms.

                                    Equations
                                    Instances For