package incr_map

  1. Overview
  2. Docs
Helpers for incremental operations on map like data structures

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=91acc784e4760af8544c4504bee1a9f6d7385eb0620f8e56392cd193a250b7d2

doc/incr_map.collate/Incr_map_collate/index.html

Module Incr_map_collateSource

Sourcemodule Collate : sig ... end
Sourcemodule Collated : sig ... end
Sourcemodule Store_params = Incr_memoize.Store_params
Sourcemodule Compare : sig ... end
Sourcemodule Fold : sig ... end
Sourcetype ('k, 'v, 'fold_result, 'w) t
Sourceval collate : ?operation_order:[ `Filter_first | `Sort_first ] -> 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.t, 'w) Incremental.t -> ('k, 'v, unit, 'w) t

Perform filtering, sorting and restricting to ranges.

The Collate.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.t, and ways to convert them to predicate & compare here.

It is done this way for better interaction with Incr. We belive 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.

Sourceval collate_and_fold : ?operation_order:[ `Filter_first | `Sort_first ] -> 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.t, 'w) Incremental.t -> ('k, 'v, 'fold_result, 'w) t
Sourceval collated : ('k, 'v, 'fold_result, 'w) t -> (('k, 'v) Collated.t, 'w) Incremental.t

Gets the collated data produced by a collation function like collate.

Sourceval key_rank : ('k, 'v, 'fold_result, 'w) t -> ('k -> int option, 'w) Incremental.t

A 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.

Sourceval fold_result : ('k, 'v, 'fold_result, 'w) t -> ('fold_result, 'w) Incremental.t
Sourcemodule With_caching : sig ... end

A version of collate with caching.

OCaml

Innovation. Community. Security.