mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 19:25:28 -05:00
CCTrie.MakeList/MakeArray
This commit is contained in:
parent
5dc0155ab0
commit
be7d94fac4
2 changed files with 30 additions and 0 deletions
|
|
@ -417,6 +417,27 @@ module Make(W : WORD) = struct
|
|||
`Node(x, List.map (fun (c,t') -> _tree_node (`Char c) [to_tree t']) l)
|
||||
end
|
||||
|
||||
module type ORDERED = sig
|
||||
type t
|
||||
val compare : t -> t -> int
|
||||
end
|
||||
|
||||
module MakeArray(X : ORDERED) = Make(struct
|
||||
type t = X.t array
|
||||
type char_ = X.t
|
||||
let compare = X.compare
|
||||
let to_seq a k = Array.iter k a
|
||||
let of_list = Array.of_list
|
||||
end)
|
||||
|
||||
module MakeList(X : ORDERED) = Make(struct
|
||||
type t = X.t list
|
||||
type char_ = X.t
|
||||
let compare = X.compare
|
||||
let to_seq a k = List.iter k a
|
||||
let of_list l = l
|
||||
end)
|
||||
|
||||
module String = Make(struct
|
||||
type t = string
|
||||
type char_ = char
|
||||
|
|
|
|||
|
|
@ -110,4 +110,13 @@ end
|
|||
|
||||
module Make(W : WORD) : S with type key = W.t and type char_ = W.char_
|
||||
|
||||
module type ORDERED = sig
|
||||
type t
|
||||
val compare : t -> t -> int
|
||||
end
|
||||
|
||||
module MakeArray(X : ORDERED) : S with type key = X.t array and type char_ = X.t
|
||||
|
||||
module MakeList(X : ORDERED) : S with type key = X.t list and type char_ = X.t
|
||||
|
||||
module String : S with type key = string and type char_ = char
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue