The standard library Numbered_Set api defines access to binary tree datastructures which both efficiently test keys for membership also allow keys to be accessed by sequential number within the ordered keyset.
Implementations of the Numbered_Set api may be generated via red_black_numbered_set_g from src/lib/src/red-black-numbered-set-g.pkg.
The Numbered_Set api source code is in src/lib/src/numbered-list.api.
See also: Numbered_List.
The above information is manually maintained and may contain errors.
api { package key : api { Key; compare : (Key , Key) -> Order;};; Numbered_Set; empty : Numbered_Set; is_empty : Numbered_Set -> Bool; from_list : List(key::Key ) -> Numbered_Set; singleton : key::Key -> Numbered_Set; set : (Numbered_Set , key::Key) -> Numbered_Set; set' : (key::Key , Numbered_Set) -> Numbered_Set; $ : (Numbered_Set , key::Key) -> Numbered_Set; find : (Numbered_Set , key::Key) -> Null_Or(Int ); contains_key : (Numbered_Set , key::Key) -> Bool; remove : (Numbered_Set , key::Key) -> (Numbered_Set , Int); first_key_else_null : Numbered_Set -> Null_Or(key::Key ); vals_count : Numbered_Set -> Int; keys_list : Numbered_Set -> List(key::Key ); union_with : ((X , X) -> X) -> (Numbered_Set , Numbered_Set) -> Numbered_Set; keyed_union_with : ((key::Key , X , X) -> X) -> (Numbered_Set , Numbered_Set) -> Numbered_Set; intersect_with : ((X , Y) -> Z) -> (Numbered_Set , Numbered_Set) -> Numbered_Set; keyed_intersect_with : ((key::Key , X , Y) -> Z) -> (Numbered_Set , Numbered_Set) -> Numbered_Set; apply : (key::Key -> Void) -> Numbered_Set -> Void; keyed_apply : ((key::Key , Int) -> Void) -> Numbered_Set -> Void; fold_forward : ((key::Key , X) -> X) -> X -> Numbered_Set -> X; keyed_fold_forward : ((key::Key , Int , X) -> X) -> X -> Numbered_Set -> X; fold_backward : ((key::Key , X) -> X) -> X -> Numbered_Set -> X; keyed_fold_backward : ((key::Key , Int , X) -> X) -> X -> Numbered_Set -> X; filter : (key::Key -> Bool) -> Numbered_Set -> Numbered_Set; keyed_filter : ((key::Key , Int) -> Bool) -> Numbered_Set -> Numbered_Set; all_invariants_hold : Numbered_Set -> Bool; debug_print : (Numbered_Set , (key::Key -> Void)) -> Int;};