Dictionary_immutable.Accessors1val is_empty : _ t -> boolWhether the dictionary is empty.
val length : _ t -> intHow many key/value pairs the dictionary contains.
val data : 'data t -> 'data listAll values in the dictionary, in the same order as to_alist.
val to_sequence : 'data t -> (key * 'data) Sequence.tLike to_alist. Produces a sequence.
Produces the current value, or absence thereof, for a given key.
Adds a key/value pair for a key the dictionary does not contain, or reports a duplicate.
Adds or replaces a key/value pair in the dictionary.
Adds, replaces, or removes the value for a given key, depending on its current value or lack thereof.
Adds or replaces the value for a given key, depending on its current value or lack thereof.
Adds data to the existing key/value pair for key. Interprets a missing key as having an empty list.
Removes one element from the existing key/value pair for key. Removes the key entirely if the new list is empty.
Produces the list associated with the corresponding key. Interprets a missing key as having an empty list.
Combines every value in the dictionary.
val fold_until :
'data t ->
init:'acc ->
f:
(key:key ->
data:'data ->
'acc ->
('acc, 'final) Container.Continue_or_stop.t) ->
finish:('acc -> 'final) ->
'finalLike fold. May stop before completing the iteration.
val for_all : 'data t -> f:('data -> bool) -> boolWhether every value satisfies f.
Like for_all. The predicate may also depend on the associated key.
val exists : 'data t -> f:('data -> bool) -> boolWhether at least one value satisfies f.
Like exists. The predicate may also depend on the associated key.
val count : 'data t -> f:('data -> bool) -> intHow many values satisfy f.
Like count. The predicate may also depend on the associated key.
val sum :
(module Container.Summable with type t = 'a) ->
'data t ->
f:('data -> 'a) ->
'aSum up f data for all data in the dictionary.
val sumi :
(module Container.Summable with type t = 'a) ->
'data t ->
f:(key:'key -> data:'data -> 'a) ->
'aLike sum. The function may also depend on the associated key.
Produces the key/value pair with the smallest key if non-empty.
Produces the key/value pair with the largest key if non-empty.
val iter : 'data t -> f:('data -> unit) -> unitCalls f for every value.
Like map. The transformation may also depend on the associated key.
Produces only those key/value pairs whose key satisfies f.
Produces only those key/value pairs whose value satisfies f.
Produces only those key/value pairs which satisfy f.
Produces key/value pairs for which f produces Some.
Like filter_map. The new value may also depend on the associated key.
Splits one dictionary into two. The first contains key/value pairs for which the value satisfies f. The second contains the remainder.
Like partition_tf. The predicate may also depend on the associated key.
Splits one dictionary into two, corresponding respectively to First _ and Second _ results from f.
val partition_mapi :
'data1 t ->
f:(key:key -> data:'data1 -> ('data2, 'data3) Either.t) ->
'data2 t * 'data3 tLike partition_map. The split may also depend on the associated key.
val combine_errors : 'data Or_error.t t -> 'data t Or_error.tProduces an error combining all error messages from key/value pairs, or a dictionary of all Ok values if none are Error.
Splits the fst and snd components of values associated with keys into separate dictionaries.
val merge :
'data1 t ->
'data2 t ->
f:
(key:key ->
[ `Left of 'data1 | `Right of 'data2 | `Both of 'data1 * 'data2 ] ->
'data3 option) ->
'data3 tMerges two dictionaries by fully traversing both. Not suitable for efficiently merging lists of dictionaries. See merge_disjoint_exn and merge_skewed instead.
Merges two dictionaries with the same type of data and disjoint sets of keys. Raises if any keys overlap.
Merges two dictionaries by traversing only the smaller of the two. Adds key/value pairs missing from the larger dictionary, and combines duplicate values.
val symmetric_diff :
'data t ->
'data t ->
data_equal:('data -> 'data -> bool) ->
(key * [ `Left of 'data | `Right of 'data | `Unequal of 'data * 'data ])
Sequence.tComputes a sequence of differences between two dictionaries.