Module Lwt_sequence
Mutable sequence of elements (deprecated)
Operation on nodes
val get : 'a node -> 'aReturns the contents of a node
val set : 'a node -> 'a -> unitChange the contents of a node
val remove : 'a node -> unitRemoves a node from the sequence it is part of. It does nothing if the node has already been removed.
Operations on sequence
val create : unit -> 'a tcreate ()creates a new empty sequence
val is_empty : 'a t -> boolReturns
trueiff the given sequence is empty
val length : 'a t -> intReturns the number of elements in the given sequence. This is a O(n) operation where
nis the number of elements in the sequence.
val take_l : 'a t -> 'atake_l x sremove and returns the leftmost element ofs- raises Empty
if the sequence is empty
val take_r : 'a t -> 'atake_l x sremove and returns the rightmost element ofs- raises Empty
if the sequence is empty
val take_opt_l : 'a t -> 'a optiontake_opt_l x sremove and returnsSome xwherexis the leftmost element ofsorNoneifsis empty
val take_opt_r : 'a t -> 'a optiontake_opt_l x sremove and returnsSome xwherexis the rightmost element ofsorNoneifsis empty
Sequence iterators
val iter_l : ('a -> unit) -> 'a t -> unititer_l f sappliesfon all elements ofsstarting from the left
val iter_r : ('a -> unit) -> 'a t -> unititer_l f sappliesfon all elements ofsstarting from the right
val iter_node_l : ('a node -> unit) -> 'a t -> unititer_l f sappliesfon all nodes ofsstarting from the left
val iter_node_r : ('a node -> unit) -> 'a t -> unititer_l f sappliesfon all nodes ofsstarting from the right
val fold_l : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'bfold_l f sis:fold_l f s x = f en (... (f e2 (f e1 x)))where
e1,e2, ...,enare the elements ofs
val fold_r : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'bfold_r f sis:fold_r f s x = f e1 (f e2 (... (f en x)))where
e1,e2, ...,enare the elements ofs
val find_node_opt_l : ('a -> bool) -> 'a t -> 'a node optionfind_node_opt_l f sreturnsSome x, wherexis the first node ofsstarting from the left that satisfiesforNoneif none exists.
val find_node_opt_r : ('a -> bool) -> 'a t -> 'a node optionfind_node_opt_r f sreturnsSome x, wherexis the first node ofsstarting from the right that satisfiesforNoneif none exists.