View Source argo_index_map (argo v1.0.8)

Summary

Types

-type filter_func() :: filter_func(index(), key(), value()).
-type filter_func(Index, Key, Value) :: fun((Index, Key, Value) -> boolean()).
-type filtermap_func() :: filtermap_func(index(), key(), value(), value()).
-type filtermap_func(Index, Key, Value1, Value2) ::
    fun((Index, Key, Value1) -> boolean() | {true, Value2}).
Link to this type

groups_from_list_key_fun/0

View Source
-type groups_from_list_key_fun() :: groups_from_list_key_fun(dynamic(), key()).
Link to this type

groups_from_list_key_fun/2

View Source
-type groups_from_list_key_fun(Elem, Key) :: fun((Elem) -> Key).
Link to this type

groups_from_list_value_fun/0

View Source
-type groups_from_list_value_fun() :: groups_from_list_value_fun(dynamic(), value()).
Link to this type

groups_from_list_value_fun/2

View Source
-type groups_from_list_value_fun(Elem, Value) :: fun((Elem) -> Value).
-type index() :: non_neg_integer().
-type iterator() :: iterator(key(), value()).
-opaque iterator(KeyType, ValueType)
-type iterator_order() :: iterator_order(key()).
-type iterator_order(Key) :: ordered | reversed | iterator_order_func(Key).
-type iterator_order_func(Key) ::
    fun((AIndex :: index(), AKey :: Key, BIndex :: index(), BKey :: Key) -> boolean()).
-type key() :: dynamic().
-type t() :: t(key(), value()).
-type t(KeyType) :: t(KeyType, value()).
-type t(KeyType, ValueType) ::
    #argo_index_map{indices :: #{KeyType => index()},
                    entries :: array:array({KeyType, ValueType})}.
-type value() :: dynamic().

Functions

Link to this function

filter(Predicate, IndexMap1)

View Source
-spec filter(Predicate, IndexMap1) -> IndexMap2
          when
              Index :: index(),
              Key :: key(),
              Value :: value(),
              Predicate :: filter_func(Index, Key, Value),
              IndexMap1 :: t(Key, Value),
              IndexMap2 :: t(Key, Value).
Link to this function

filtermap(Predicate, IndexMap1)

View Source
-spec filtermap(Predicate, IndexMap1) -> IndexMap2
             when
                 Index :: index(),
                 Key :: key(),
                 Value1 :: value(),
                 Value2 :: value(),
                 Predicate :: filtermap_func(Index, Key, Value1, Value2),
                 IndexMap1 :: t(Key, Value1),
                 IndexMap2 :: t(Key, Value2).
-spec find(Key, IndexMap) -> {ok, Value} | error
        when Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
Link to this function

find_full(Key, IndexMap)

View Source
-spec find_full(Key, IndexMap) -> {ok, {Index, Key, Value}} | error
             when Index :: index(), Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
Link to this function

find_index(Index, IndexMap)

View Source
-spec find_index(Index, IndexMap) -> {ok, {Key, Value}} | error
              when Index :: index(), Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
Link to this function

find_index_of(Key, IndexMap)

View Source
-spec find_index_of(Key, IndexMap) -> {ok, Index} | error
                 when Index :: index(), Key :: key(), IndexMap :: t(Key).
-spec first(IndexMap) -> {ok, {Key, Value}} | error when IndexMap :: t(), Key :: key(), Value :: value().
Link to this function

foldl(Function, Acc0, IndexMapOrIterator)

View Source
-spec foldl(Function, Acc0, IndexMapOrIterator) -> Acc1
         when
             Function :: fun((index(), Key, Value, AccIn) -> AccOut),
             Acc0 :: dynamic(),
             Key :: key(),
             Value :: value(),
             IndexMapOrIterator :: t(Key, Value) | iterator(Key, Value),
             Acc1 :: dynamic(),
             AccIn :: dynamic(),
             AccOut :: dynamic().
Link to this function

foldr(Function, Acc0, IndexMapOrIterator)

View Source
-spec foldr(Function, Acc0, IndexMapOrIterator) -> Acc1
         when
             Function :: fun((index(), Key, Value, AccIn) -> AccOut),
             Acc0 :: dynamic(),
             Key :: key(),
             Value :: value(),
             IndexMapOrIterator :: t(Key, Value) | iterator(Key, Value),
             Acc1 :: dynamic(),
             AccIn :: dynamic(),
             AccOut :: dynamic().
-spec from_list(KeyValueList) -> IndexMap
             when
                 KeyValueList :: [{Key, Value}],
                 Key :: key(),
                 Value :: value(),
                 IndexMap :: t(Key, Value).
-spec get(Key, IndexMap) -> Value when Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
-spec get_full(Key, IndexMap) -> {Index, Key, Value}
            when Index :: index(), Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
Link to this function

get_index(Index, IndexMap)

View Source
-spec get_index(Index, IndexMap) -> {Key, Value}
             when Index :: index(), Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
Link to this function

get_index_of(Key, IndexMap)

View Source
-spec get_index_of(Key, IndexMap) -> Index when Index :: index(), Key :: key(), IndexMap :: t(Key).
Link to this function

groups_from_list(KeyFun, List)

View Source
-spec groups_from_list(KeyFun, List) -> IndexMap
                    when
                        KeyFun :: groups_from_list_key_fun(Elem, Key),
                        List :: [Elem],
                        Elem :: dynamic(),
                        Key :: key(),
                        Value :: value(),
                        IndexMap :: t(Key, Value).
Link to this function

groups_from_list(KeyFun, ValueFun, List)

View Source
-spec groups_from_list(KeyFun, ValueFun, List) -> IndexMap
                    when
                        KeyFun :: groups_from_list_key_fun(Elem, Key),
                        ValueFun :: groups_from_list_value_fun(Elem, Value),
                        List :: [Elem],
                        Elem :: dynamic(),
                        Key :: key(),
                        Value :: value(),
                        IndexMap :: t(Key, Value).
Link to this function

is_index(Index, IndexMap)

View Source
-spec is_index(Index, IndexMap) -> boolean() when Index :: index(), IndexMap :: t().
-spec is_key(Key, IndexMap) -> boolean() when Key :: key(), IndexMap :: t(Key).
-spec iterator(IndexMap) -> Iterator
            when
                Key :: key(),
                Value :: value(),
                IndexMap :: t(Key, Value),
                Iterator :: iterator(Key, Value).
Link to this function

iterator(IndexMap, Order)

View Source
-spec iterator(IndexMap, Order) -> Iterator
            when
                Key :: key(),
                Value :: value(),
                IndexMap :: t(Key, Value),
                Order :: iterator_order(Key),
                Iterator :: iterator(Key, Value).
Link to this function

keys(IndexMapOrIterator)

View Source
-spec keys(IndexMapOrIterator) -> Keys
        when
            Key :: key(),
            Value :: value(),
            IndexMapOrIterator :: t(Key, Value) | iterator(Key, Value),
            Keys :: [Key].
-spec last(IndexMap) -> {ok, {Key, Value}} | error
        when Key :: key(), Value :: value(), IndexMap :: t(Key, Value).
-spec new() -> IndexMap when IndexMap :: t().
-spec next(Iterator) -> none | {Index, Key, Value, NextIterator}
        when
            Index :: index(),
            Key :: key(),
            Value :: value(),
            Iterator :: iterator(Key, Value),
            NextIterator :: iterator(Key, Value).
Link to this function

put(Key, Value, IndexMap1)

View Source
-spec put(Key, Value, IndexMap1) -> IndexMap2
       when Key :: key(), Value :: value(), IndexMap1 :: t(Key, Value), IndexMap2 :: t(Key, Value).
-spec remove(Key, IndexMap1) -> IndexMap2 when Key :: key(), IndexMap1 :: t(Key), IndexMap2 :: t(Key).
Link to this function

remove_index(Index, IndexMap1)

View Source
-spec remove_index(Index, IndexMap1) -> IndexMap2
                when Index :: index(), Key :: key(), IndexMap1 :: t(Key), IndexMap2 :: t(Key).
-spec size(IndexMap) -> non_neg_integer() when IndexMap :: t().
-spec sort(IndexMap1) -> IndexMap2
        when
            Key :: key(), Value :: value(), IndexMap1 :: t(Key, Value), IndexMap2 :: t(Key, Value).
Link to this function

sort(SortFun, IndexMap1)

View Source
-spec sort(SortFun, IndexMap1) -> IndexMap2
        when
            SortFun :: iterator_order_func(Key),
            Key :: key(),
            Value :: value(),
            IndexMap1 :: t(Key, Value),
            IndexMap2 :: t(Key, Value).
-spec take(Key, IndexMap1) -> {Value, IndexMap2} | error
        when
            Key :: key(), Value :: value(), IndexMap1 :: t(Key, Value), IndexMap2 :: t(Key, Value).
Link to this function

take_full(Key, IndexMap1)

View Source
-spec take_full(Key, IndexMap1) -> {{Index, Key, Value}, IndexMap2} | error
             when
                 Index :: index(),
                 Key :: key(),
                 Value :: value(),
                 IndexMap1 :: t(Key, Value),
                 IndexMap2 :: t(Key, Value).
Link to this function

take_index(Index, IndexMap1)

View Source
-spec take_index(Index, IndexMap1) -> {{Key, Value}, IndexMap2} | error
              when
                  Index :: index(),
                  Key :: key(),
                  Value :: value(),
                  IndexMap1 :: t(Key, Value),
                  IndexMap2 :: t(Key, Value).
Link to this function

take_index_of(Key, IndexMap1)

View Source
-spec take_index_of(Key, IndexMap1) -> {Index, IndexMap2} | error
                 when Index :: index(), Key :: key(), IndexMap1 :: t(Key), IndexMap2 :: t(Key).
Link to this function

to_list(IndexMapOrIterator)

View Source
-spec to_list(IndexMapOrIterator) -> KeyValueList
           when
               Key :: key(),
               Value :: value(),
               IndexMapOrIterator :: t(Key, Value) | iterator(Key, Value),
               KeyValueList :: [{Key, Value}].
Link to this function

update(Key, Value, IndexMap1)

View Source
-spec update(Key, Value, IndexMap1) -> IndexMap2
          when
              Key :: key(),
              Value :: value(),
              IndexMap1 :: t(Key, Value),
              IndexMap2 :: t(Key, Value).
Link to this function

update_with(Key, UpdateFun, IndexMap1)

View Source
-spec update_with(Key, UpdateFun, IndexMap1) -> IndexMap2
               when
                   Key :: key(),
                   UpdateFun :: fun((Index, Value1) -> Value2),
                   Index :: index(),
                   Value1 :: value(),
                   Value2 :: value(),
                   IndexMap1 :: t(Key, Value1),
                   IndexMap2 :: t(Key, Value2).
Link to this function

update_with(Key, UpdateFun, InitValue, IndexMap1)

View Source
-spec update_with(Key, UpdateFun, InitValue, IndexMap1) -> IndexMap2
               when
                   Key :: key(),
                   UpdateFun :: fun((Index, Value1) -> Value2),
                   Index :: index(),
                   Value1 :: value(),
                   Value2 :: value(),
                   InitValue :: value(),
                   IndexMap1 :: t(Key, Value1),
                   IndexMap2 :: t(Key, Value2).
Link to this function

values(IndexMapOrIterator)

View Source
-spec values(IndexMapOrIterator) -> Values
          when
              Key :: key(),
              Value :: value(),
              IndexMapOrIterator :: t(Key, Value) | iterator(Key, Value),
              Values :: [Value].