mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 19:55:31 -05:00
formatting in CCTrie
This commit is contained in:
parent
563927a592
commit
ae06357487
2 changed files with 151 additions and 196 deletions
|
|
@ -1,27 +1,5 @@
|
|||
(*
|
||||
copyright (c) 2013-2014, simon cruanes
|
||||
all rights reserved.
|
||||
|
||||
redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer. redistributions in binary
|
||||
form must reproduce the above copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other materials provided with
|
||||
the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*)
|
||||
(* This file is free software, part of containers. See file "license" for more details. *)
|
||||
|
||||
(** {1 Prefix Tree} *)
|
||||
|
||||
|
|
@ -32,7 +10,7 @@ type 'a ktree = unit -> [`Nil | `Node of 'a * 'a ktree list]
|
|||
|
||||
(** {6 A Composite Word}
|
||||
|
||||
Words are made of characters, who belong to a total order *)
|
||||
Words are made of characters, who belong to a total order *)
|
||||
|
||||
module type WORD = sig
|
||||
type t
|
||||
|
|
@ -131,7 +109,7 @@ end
|
|||
let t1 = T.of_list l1
|
||||
|
||||
let small_l l = List.fold_left (fun acc (k,v) -> List.length k+acc) 0 l
|
||||
*)
|
||||
*)
|
||||
|
||||
(*$T
|
||||
String.of_list ["a", 1; "b", 2] |> String.size = 2
|
||||
|
|
@ -630,7 +608,7 @@ module MakeArray(X : ORDERED) = Make(struct
|
|||
let compare = X.compare
|
||||
let to_seq a k = Array.iter k a
|
||||
let of_list = Array.of_list
|
||||
end)
|
||||
end)
|
||||
|
||||
module MakeList(X : ORDERED) = Make(struct
|
||||
type t = X.t list
|
||||
|
|
@ -638,7 +616,7 @@ module MakeList(X : ORDERED) = Make(struct
|
|||
let compare = X.compare
|
||||
let to_seq a k = List.iter k a
|
||||
let of_list l = l
|
||||
end)
|
||||
end)
|
||||
|
||||
module String = Make(struct
|
||||
type t = string
|
||||
|
|
@ -649,4 +627,4 @@ module String = Make(struct
|
|||
let buf = Buffer.create (List.length l) in
|
||||
List.iter (fun c -> Buffer.add_char buf c) l;
|
||||
Buffer.contents buf
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -1,27 +1,5 @@
|
|||
(*
|
||||
copyright (c) 2013-2014, simon cruanes
|
||||
all rights reserved.
|
||||
|
||||
redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer. redistributions in binary
|
||||
form must reproduce the above copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other materials provided with
|
||||
the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*)
|
||||
(* This file is free software, part of containers. See file "license" for more details. *)
|
||||
|
||||
(** {1 Prefix Tree} *)
|
||||
|
||||
|
|
@ -32,7 +10,7 @@ type 'a ktree = unit -> [`Nil | `Node of 'a * 'a ktree list]
|
|||
|
||||
(** {6 A Composite Word}
|
||||
|
||||
Words are made of characters, who belong to a total order *)
|
||||
Words are made of characters, who belong to a total order *)
|
||||
|
||||
module type WORD = sig
|
||||
type t
|
||||
|
|
@ -77,13 +55,11 @@ module type S = sig
|
|||
|
||||
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
|
||||
(** Map values, giving both key and value. Will use {!WORD.of_list} to rebuild keys.
|
||||
@since NEXT_RELEASE
|
||||
*)
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||
(** Map values, giving only the value.
|
||||
@since NEXT_RELEASE
|
||||
*)
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val iter : (key -> 'a -> unit) -> 'a t -> unit
|
||||
(** Same as {!fold}, but for effectful functions *)
|
||||
|
|
@ -117,7 +93,8 @@ module type S = sig
|
|||
(** {6 Ranges} *)
|
||||
|
||||
val above : key -> 'a t -> (key * 'a) sequence
|
||||
(** All bindings whose key is bigger or equal to the given key *)
|
||||
(** All bindings whose key is bigger or equal to the given key, in
|
||||
ascending order *)
|
||||
|
||||
val below : key -> 'a t -> (key * 'a) sequence
|
||||
(** All bindings whose key is smaller or equal to the given key *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue