Module Prime_enumset.Make
Parameters
Signature
include S with type elt = Elt.t
type elt= Elt.tThe type of the elements of the set.
val empty : tThe empty set.
val is_empty : t -> boolHolds for the empty set only.
val cardinal : t -> intcardinal sis the cardinality ofs.
val locate : elt -> t -> bool * intlocate e sis a pair(present, pos)wherepresentis true iffeis a member ofs, andposis the number of elements ofswhich precedese.
val min_elt_exn : t -> eltmin_elt_exn sis the smallest element ofs.- raises Not_found
if the set is empty.
val max_elt_exn : t -> eltmax_elt_exn sis the largest element ofs.- raises Not_found
if the set is empty.
val cut_element : elt -> t -> bool * t * tcut_element k sis(contains k s, sL, sR)wheresLandsRare the subsets ofswith keys smaller and larger thank, respectively.
val pop_min_exn : t -> elt * tpop_min_exn sis(e, s')whereeis the smallest element ofsands'contains the remaining elements.- raises Not_found
if the set is empty.
val pop_max_exn : t -> elt * tpop_max_exn sis(e, s')whereeis the largest element ofsands'contains the remaining elements.- raises Not_found
if the set is empty.
val of_ordered_elements : elt list -> tof_ordered_elements esis the set containing precisely the elementses, which must be listed in order.- raises Invalid_argument
if
esis not sorted.
val asc_elements : ?where:(elt -> int) -> t -> elt Stdlib.Seq.tasc_elements ?where sis the sequence of elements ofein ascending order, optionally restricted to a subrange given bywhere.- parameter where
must be a monotonically increasing function, in which case the returned elements will be the continuous range at which it evaluates to zero.
val dsc_elements : ?where:(elt -> int) -> t -> elt Stdlib.Seq.tdsc_elements ?where sis the sequence of elements ofein descending order, optionally restricted to a subrange given bywhere.- parameter where
must be a monotonically increasing function, in which case the returned elements will be the continuous range at which it evaluates to zero.
val search : (elt -> 'a option) -> t -> 'a optionsearch f sis the firstf eforeinswhich is different fromNone, orNoneif there is no suche.
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'afold f sis the composition off efor eacheinsapplied in order of increasinge.
val fold_rev : (elt -> 'a -> 'a) -> t -> 'a -> 'afold_rev f sis the composition off eforeinsapplied in order of decreasinge.
val iter : (elt -> unit) -> t -> unititer f scallsf efor eacheinsin order of increasing elements.
module Make_monadic : functor (Monad : Prime_sigs.Monad) -> S_monadic with type elt := elt and type t := t and type 'a monad = 'a Monad.t