Incr_map_collatemodule Collate_params : sig ... endmodule Collated : sig ... endmodule Store_params = Incr_memoize.Store_paramsmodule Instrumentation : sig ... endmodule Compare : sig ... endmodule Fold : sig ... endval collate :
?operation_order:[ `Filter_first | `Sort_first ] ->
?instrumentation:Instrumentation.t ->
filter_equal:('filter -> 'filter -> bool) ->
order_equal:('order -> 'order -> bool) ->
filter_to_predicate:('filter -> (key:'k -> data:'v -> bool) option) ->
order_to_compare:('order -> ('k, 'v, 'cmp) Compare.t) ->
(('k, 'v, 'cmp) Core.Map.t, 'w) Incremental.t ->
(('k, 'filter, 'order) Collate_params.t, 'w) Incremental.t ->
('k, 'v, 'cmp, unit, 'w) t @@ portablePerform filtering, sorting and restricting to ranges.
The Collate_params.t Incr.t contains the parameters for filtering and sorting, and ranges. It can be updated incrementally, but note that filtering & sorting isn't really incremental on filter & order since we bind to these.
For sorting & filtering, technically all this function should need is a compare function and a filtering predicate. However, the interface is slightly different: we require users to provide 'filter and 'order opaque types in Collate_params.t, and ways to convert them to predicate & compare here.
It is done this way for better interaction with Incr. We believe that most users would have such types, being simple algebraic data types, anyways. You can always set e.g. filter_to_predicate=Fn.id, and just pass the functions directly, but be prepared to explore the fascinating world of functions' physical equality.
val collate_and_fold :
?operation_order:[ `Filter_first | `Sort_first ] ->
?instrumentation:Instrumentation.t ->
filter_equal:('filter -> 'filter -> bool) ->
order_equal:('order -> 'order -> bool) ->
filter_to_predicate:('filter -> (key:'k -> data:'v -> bool) option) ->
order_to_compare:('order -> ('k, 'v, 'cmp) Compare.t) ->
fold:('k, 'v, 'fold_result) Fold.t ->
(('k, 'v, 'cmp) Core.Map.t, 'w) Incremental.t ->
(('k, 'filter, 'order) Collate_params.t, 'w) Incremental.t ->
('k, 'v, 'cmp, 'fold_result, 'w) t @@ portableval collated :
('k, 'v, _, 'fold_result, 'w) t ->
(('k, 'v) Collated.t, 'w) Incremental.t @@ portableGets the collated data produced by a collation function like collate.
val key_rank :
('k, _, _, 'fold_result, 'w) t ->
('k -> int option, 'w) Incremental.t @@ portableA function for finding the index into the collated map of a particular key. The resulting index is "pre-range-restriction", which means that even if the key is not in the collation range, key_rank can still respond with its index. However, the index is after filtering and ordering, which means that if it is filtered out of the map (or isn't in the original map), then the result will be None.
module Key_rank : sig ... endThis Key_rank module and it's associated key_rank' accessor function are primarily used to allow key ranking to move between threads using OCaml's portability mode. If you dont' care about using Incr_map_collate in a separate thread, then you can ignore this and just use the regular key_rank function.
val key_rank' :
('k, 'v, 'cmp, 'fold_result, 'w) t ->
(('k, 'v, 'cmp) Key_rank.t, 'w) Incremental.t @@ portableval fold_result :
(_, _, _, 'fold_result, 'w) t ->
('fold_result, 'w) Incremental.t @@ portablemodule With_caching : sig ... endA version of collate with caching.