PreviousUpNext

14.2.26  Map

The standard library Map api defines an interface for datastructures which map keys to values, typically based upon some sort of binary tree datastructure.

The Map api is implemented by the int_binary_map, unt_red_black_map, int_red_black_map and int_list_map packages.

Red-black trees are the de facto standard Mythryl balanced binary tree type, so int_red_black_map may be considered the standard tree-based Map implementation.

The Map api source code is in src/lib/src/map.api.

The above information is manually maintained and may contain errors.

api {   package key
          : api {
                Key;
                compare : (Key , Key) -> Order;};;
    Map X;
    empty : Map(X );
    is_empty : Map(X ) -> Bool;
    singleton : (key::Key , X) -> Map(X );
    from_list : List(((key::Key , X)) ) -> Map(X );
    set : (Map(X ) , key::Key , X) -> Map(X );
    set' : (((key::Key , X)) , Map(X )) -> Map(X );
    $ : (Map(X ) , ((key::Key , X))) -> Map(X );
    get : (Map(X ) , key::Key) -> Null_Or(X );
    get_or_raise_exception_not_found : (Map(X ) , key::Key) -> X;
    contains_key : (Map(X ) , key::Key) -> Bool;
    preceding_key : (Map(X ) , key::Key) -> Null_Or(key::Key );
    following_key : (Map(X ) , key::Key) -> Null_Or(key::Key );
    get_and_drop : (Map(X ) , key::Key) -> (Map(X ) , Null_Or(X ));
    drop : (Map(X ) , key::Key) -> Map(X );
    first_val_else_null : Map(X ) -> Null_Or(X );
    first_keyval_else_null : Map(X ) -> Null_Or(((key::Key , X)) );
    last_val_else_null : Map(X ) -> Null_Or(X );
    last_keyval_else_null : Map(X ) -> Null_Or(((key::Key , X)) );
    vals_count : Map(X ) -> Int;
    vals_list : Map(X ) -> List(X );
    keyvals_list : Map(X ) -> List(((key::Key , X)) );
    keys_list : Map(X ) -> List(key::Key );
    compare_sequences : ((X , X) -> Order) -> (Map(X ) , Map(X )) -> Order;
    difference_with : (Map(X ) , Map(X )) -> Map(X );
    union_with : ((X , X) -> X) -> (Map(X ) , Map(X )) -> Map(X );
    keyed_union_with : ((key::Key , X , X) -> X) -> (Map(X ) , Map(X )) -> Map(X );
    intersect_with : ((X , Y) -> Z) -> (Map(X ) , Map(Y )) -> Map(Z );
    keyed_intersect_with : ((key::Key , X , Y) -> Z) -> (Map(X ) , Map(Y )) -> Map(Z );
    merge_with : ((Null_Or(X ) , Null_Or(Y )) -> Null_Or(Z )) -> (Map(X ) , Map(Y )) -> Map(Z );
        keyed_merge_with :
        ((key::Key , Null_Or(X ) , Null_Or(Y )) -> Null_Or(Z )) -> (Map(X ) , Map(Y )) -> Map(Z );
    apply : (X -> Void) -> Map(X ) -> Void;
    keyed_apply : ((key::Key , X) -> Void) -> Map(X ) -> Void;
    map : (X -> Y) -> Map(X ) -> Map(Y );
    keyed_map : ((key::Key , X) -> Y) -> Map(X ) -> Map(Y );
    fold_forward : ((X , Y) -> Y) -> Y -> Map(X ) -> Y;
    keyed_fold_forward : ((key::Key , X , Y) -> Y) -> Y -> Map(X ) -> Y;
    fold_backward : ((X , Y) -> Y) -> Y -> Map(X ) -> Y;
    keyed_fold_backward : ((key::Key , X , Y) -> Y) -> Y -> Map(X ) -> Y;
    filter : (X -> Bool) -> Map(X ) -> Map(X );
    keyed_filter : ((key::Key , X) -> Bool) -> Map(X ) -> Map(X );
    map' : (X -> Null_Or(Y )) -> Map(X ) -> Map(Y );
    keyed_map' : ((key::Key , X) -> Null_Or(Y )) -> Map(X ) -> Map(Y );
    all_invariants_hold : Map(X ) -> Bool;
    debug_print : (Map(X ) , (key::Key -> Void) , (X -> Void)) -> Int;};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext