Page
Library
Module
Module type
Parameter
Class
Class type
Source
Lwd_tableLwd_table is an ordered collection with an impure interface. It is designed to be efficient in an interactive setting.
The interface mimics the one of a doubly-linked lists: from a node, called row, you can iterate backward and forward, insert and delete other nodes, and change the value it is bound to.
The sequence of nodes can be observed by map/reduce operations, that will be recomputed efficiently when sequence changes.
val make : unit -> 'a tCreate a new table
Insert and return a new row at the start of a table. It can be optionnally initialized to the value of set.
Insert and return a new row at the end of a table. It can be optionnally initialized to the value of set.
val prepend' : 'a t -> 'a -> unitval append' : 'a t -> 'a -> unitInsert and return a new row just before an existing row. It can be optionnally initialized to the value of set.
If the input row is unbound (is_bound returns false), the returned row is too.
Insert and return a new row just after an existing row. It can be optionnally initialized to the value of set.
If the input row is unbound (is_bound returns false), the returned row is too.
Returns the row next to another one, or None if the input row is unbound or is the last row
Returns the row just before another one, or None if the input row is unbound or is the first row
val get : 'a row -> 'a optionGet the value associated with a row, if any, or None if the row is unbound
val set : 'a row -> 'a -> unitSet the value associated with a row, or do nothing if the row is unbound
val unset : 'a row -> unitUnset the value associated with a row
val is_bound : 'a row -> boolReturns true iff the row is bound in a table (it has not beem removed yet, the table has not been cleared)
val remove : 'a row -> unitremove a row from its table, is_bound will be true after that
val clear : 'a t -> unitRemove all rows from a table
val reduce : 'a Lwd_utils.monoid -> 'a t -> 'a Lwd.tObserve the content of a table by reducing it with a monoid
val map_reduce :
('a row -> 'a -> 'b) ->
'b Lwd_utils.monoid ->
'a t ->
'b Lwd.tObserve the content of a table by mapping and reducing it
val iter : ('a -> unit) -> 'a t -> unitImmediate, non reactive, iteration over elements of a table