module Make:
Container.Make
is to bind the resulting module and to explicitly
import each of the functions that one wants:
module C = Container.Make (struct ... end)
let count = C.count
let exists = C.exists
let find = C.find
...
This is preferable to:
include Container.Make (struct ... end)
because the include
makes it to easy to shadow specialized implementations of
container functions (length
being a common one).
Container.Make
implements iter
in terms of fold
, which is often slower than
implementing iter
directly.
Parameters: |
|
val fold : 'a Container.T.t -> init:'b -> f:('b -> 'a -> 'b) -> 'b
val count : 'a Container.T.t -> f:('a -> bool) -> int
val iter : 'a Container.T.t -> f:('a -> unit) -> unit
val length : 'a Container.T.t -> int
val is_empty : 'a Container.T.t -> bool
val exists : 'a Container.T.t -> f:('a -> bool) -> bool
val mem : ?equal:('a -> 'a -> bool) -> 'a Container.T.t -> 'a -> bool
val for_all : 'a Container.T.t -> f:('a -> bool) -> bool
val find_map : 'a Container.T.t -> f:('a -> 'b option) -> 'b option
val find : 'a Container.T.t -> f:('a -> bool) -> 'a option
val to_list : 'a Container.T.t -> 'a list
val to_array : 'a Container.T.t -> 'a array