The standard library Numbered_List api defines access to binary tree datastructures which both map keys to values and also allows keys to be accessed by sequential number within the ordered keyset.
The Numbered_List api is implemented by the red_black_numbered_list package.
The Numbered_List api source code is in src/lib/src/numbered-list.api.
See also: Numbered_Set.
The above information is manually maintained and may contain errors.
api { Numbered_List X; empty : Numbered_List(X ); is_empty : Numbered_List(X ) -> Bool; from_list : List(X ) -> Numbered_List(X ); singleton : X -> Numbered_List(X ); set : (Numbered_List(X ) , Int , X) -> Numbered_List(X ); set' : (((Int , X)) , Numbered_List(X )) -> Numbered_List(X ); $ : (Numbered_List(X ) , ((Int , X))) -> Numbered_List(X ); find : (Numbered_List(X ) , Int) -> Null_Or(X ); get : (Numbered_List(X ) , Int) -> X; _[] : (Numbered_List(X ) , Int) -> X; min_key : Numbered_List(X ) -> Null_Or(Int ); max_key : Numbered_List(X ) -> Null_Or(Int ); contains_key : (Numbered_List(X ) , Int) -> Bool; remove : (Numbered_List(X ) , Int) -> Numbered_List(X ); first_val_else_null : Numbered_List(X ) -> Null_Or(X ); last_val_else_null : Numbered_List(X ) -> Null_Or(X ); first_keyval_else_null : Numbered_List(X ) -> Null_Or(((Int , X)) ); last_keyval_else_null : Numbered_List(X ) -> Null_Or(((Int , X)) ); shift : Numbered_List(X ) -> Null_Or(Numbered_List(X ) ); pop : Numbered_List(X ) -> Null_Or(Numbered_List(X ) ); push : (Numbered_List(X ) , X) -> Numbered_List(X ); unshift : (Numbered_List(X ) , X) -> Numbered_List(X ); vals_count : Numbered_List(X ) -> Int; vals_list : Numbered_List(X ) -> List(X ); keyvals_list : Numbered_List(X ) -> List(((Int , X)) ); keys_list : Numbered_List(X ) -> List(Int ); compare_sequences : ((X , X) -> Order) -> (Numbered_List(X ) , Numbered_List(X )) -> Order; union_with : ((X , X) -> X) -> (Numbered_List(X ) , Numbered_List(X )) -> Numbered_List(X ); keyed_union_with : ((Int , X , X) -> X) -> (Numbered_List(X ) , Numbered_List(X )) -> Numbered_List(X ); intersect_with : ((X , Y) -> Z) -> (Numbered_List(X ) , Numbered_List(Y )) -> Numbered_List(Z ); keyed_intersect_with : ((Int , X , Y) -> Z) -> (Numbered_List(X ) , Numbered_List(Y )) -> Numbered_List(Z ); merge_with : ((Null_Or(X ) , Null_Or(Y )) -> Null_Or(Z )) -> (Numbered_List(X ) , Numbered_List(Y )) -> Numbered_List(Z ); keyed_merge_with : ((Int , Null_Or(X ) , Null_Or(Y )) -> Null_Or(Z )) -> (Numbered_List(X ) , Numbered_List(Y )) -> Numbered_List(Z ); apply : (X -> Void) -> Numbered_List(X ) -> Void; keyed_apply : ((Int , X) -> Void) -> Numbered_List(X ) -> Void; map : (X -> Y) -> Numbered_List(X ) -> Numbered_List(Y ); keyed_map : ((Int , X) -> Y) -> Numbered_List(X ) -> Numbered_List(Y ); fold_forward : ((X , Y) -> Y) -> Y -> Numbered_List(X ) -> Y; keyed_fold_forward : ((Int , X , Y) -> Y) -> Y -> Numbered_List(X ) -> Y; fold_backward : ((X , Y) -> Y) -> Y -> Numbered_List(X ) -> Y; keyed_fold_backward : ((Int , X , Y) -> Y) -> Y -> Numbered_List(X ) -> Y; filter : (X -> Bool) -> Numbered_List(X ) -> Numbered_List(X ); keyed_filter : ((Int , X) -> Bool) -> Numbered_List(X ) -> Numbered_List(X ); map' : (X -> Null_Or(Y )) -> Numbered_List(X ) -> Numbered_List(Y ); keyed_map' : ((Int , X) -> Null_Or(Y )) -> Numbered_List(X ) -> Numbered_List(Y ); all_invariants_hold : Numbered_List(X ) -> Bool; debug_print : (Numbered_List(X ) , (X -> Void)) -> Int;};