Functor Computation.Dashtbl


module Dashtbl: 
functor (Key : Hashtbl.HashedType) ->
functor (Data : Project.Datatype.S) ->
functor (Info : Signature.NAME_SIZE_DPDS) -> DASHTBL_OUTPUT with type key = Key.t and type data = Data.t
Build a dashtable from hashable keys, a datatype for values and usual additionnal information.
Since Boron-20100401
Parameters:
Key : Hashtbl.HashedType
Data : Project.Datatype.S
Info : Signature.NAME_SIZE_DPDS


Datatypes


include Project.Computation.OUTPUT

A dashtable is a standard computation. BUT:
type key 
Type of keys of the table.
Since Boron-20100401
type data 
Type of values of the table.
Since Boron-20100401

Modifying the table


val add : key ->
Project.Computation.t list -> data -> unit
Add a new binding key, data in the tables. The dependencies are the states required for computing the binding. More precisely, a binding is a triple key --> state --> data and add k l d adds as many bindings as the length of the list, but all these bindings corresponds to the very same state.

Be aware that add k [ s1; s2 ] v is NOT equivalent to add k [ s1 ] v; add k [ s2 ] v.


Since Boron-20100401
val replace : reset:bool ->
key ->
Project.Computation.t list -> data -> unit
Similar to add but replace the existing bindings if any (same difference that Hashtbl.replace wrt Hashtbl.add. If reset to true, all the dependencies of old bindings are cleared. It is always safe to put reset to true, but it may be unsafe to put it to false. reset era
Since Boron-20100401
val memo : reset:bool ->
(data list -> data) ->
key ->
Project.Computation.t list -> data
memo f k l replaces the bindings in the table by a new one computed by applying f. The argument of f is the list of existing bindings (the empty list if there is no binding). If reset to true, all the dependencies of old bindings are cleared. It is always safe to put reset to true, but it may be unsafe to put it to false.
Since Boron-20100401
val clear : reset:bool -> unit -> unit
Remove all the bindings of the table. If reset is true, all the dependencies of the table are also cleared. It is always safe to put reset to true, but it may be unsafe to put it to false.
Since Boron-20100401
val remove : reset:bool -> key -> Project.Computation.t -> unit
Remove all the bindings associated to the given key and state. Do nothing if there is no such binding. If reset is true, clear all athe dependencies of the removed binding. It is always safe to put reset to true, but it may be unsafe to put it to false.
Since Boron-20100401
val remove_all : reset:bool -> key -> unit
Remove all the bindings added and associated to the given key. Do nothing if there is no such binding. If reset is true, clear all the dependencies of each removed binding. It is always safe to put reset to true, but it may be unsafe to put it to false.
Since Boron-20100401
val filter : reset:bool ->
(key ->
Project.Computation.t -> data -> bool) ->
key -> unit
Remove all the bindings added and associated to the given key and which does not satisfy the given condition. Do nothing if there is no such binding. If reset is true, clear all the dependencies of each removed binding. It is always safe to put reset to true, but it may be unsafe to put it to false.
Since Boron-20100401

Finders


val mem : key -> bool
Since Boron-20100401
Returns true if there is a binding with the given key.
val find : ?who:Project.Computation.t list ->
key ->
Project.Computation.t ->
data * Project.Computation.t
Get the binding associated to the given key and state. if who is set, automatically adds dependency from the found state to each of states of who.
Since Boron-20100401
Raises Not_found if there is no such binding
val find_data : ?who:Project.Computation.t list ->
key ->
Project.Computation.t -> data
Get the data associated to the given key and state. if who is set, automatically adds dependency from the state corresponding to the given data to each of states of who.
Since Boron-20100401
Raises Not_found if there is no such binding
val find_state : ?who:Project.Computation.t list ->
key ->
Project.Computation.t -> Project.Computation.t
Get the state associated to the given key and state. if who is set, automatically adds dependency from the found state to each of states of who.
Since Boron-20100401
Raises Not_found if there is no such binding
val find_all_local : ?who:Project.Computation.t list ->
key ->
Project.Computation.t ->
(data * Project.Computation.t) list
Get all the bindings associated to the given key and state. if who is set, automatically adds dependency from each found state to each of states of who.
Since Boron-20100401
val find_all_local_data : ?who:Project.Computation.t list ->
key ->
Project.Computation.t -> data list
Get all the data associated to the given key and state. if who is set, automatically adds dependency from the state corresponding to each data to each of states of who.
Since Boron-20100401
val find_all_local_state : ?who:Project.Computation.t list ->
key ->
Project.Computation.t -> Project.Computation.t list
Get all the states associated to the given key and state. if who is set, automatically adds dependency from each found state to each of states of who.
Since Boron-20100401
val find_all : ?who:Project.Computation.t list ->
key ->
(data * Project.Computation.t) list
Get all bindings associated to the given key. if who is set, automatically adds dependency from each found state to each of states of who.
Since Boron-20100401
val find_all_data : ?who:Project.Computation.t list ->
key -> data list
Get all data associated to the given key. if who is set, automatically adds dependency from the state correspondin to of each found data to each of states of who.
Since Boron-20100401
val find_all_states : ?who:Project.Computation.t list ->
key -> Project.Computation.t list
Get all states associated to the given key. if who is set, automatically adds dependency from each found state to each of states of who.
Since Boron-20100401

Iterators


val iter : (key ->
Project.Computation.t -> data -> unit) ->
unit
Iterator on each binding of the table.
Since Boron-20100401
val iter_key : (Project.Computation.t -> data -> unit) ->
key -> unit
Iterator on each binding of the table associated to the given key.
Since Boron-20100401
val fold : (key ->
Project.Computation.t -> data -> 'a -> 'a) ->
'a -> 'a
Folder on each binding of the table.
Since Boron-20100401
val fold_key : (Project.Computation.t -> data -> 'a -> 'a) ->
key -> 'a -> 'a
Folder on each binding of the table associated to the given key.
Since Boron-20100401

Miscellaneous


val length : unit -> int
Number of bindings in the table.
Since Boron-20100401
val add_dependency : Project.Computation.t -> Project.Computation.t -> unit
Add a dependency local to the dash-table. At least one of the two given states must be either self (the state of the dashtable) or the state of one binding of the table.
Since Boron-20100401