mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 19:25:28 -05:00
style: reindent
This commit is contained in:
parent
b874ff9bf9
commit
972a6f2720
8 changed files with 77 additions and 77 deletions
|
|
@ -84,7 +84,7 @@ let rev s =
|
||||||
(*$Q
|
(*$Q
|
||||||
Q.printable_string (fun s -> \
|
Q.printable_string (fun s -> \
|
||||||
rev s = (to_list s |> List.rev |> of_list))
|
rev s = (to_list s |> List.rev |> of_list))
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
|
||||||
(*$=
|
(*$=
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ let of_string s = if is_valid s then Some s else None
|
||||||
let printer s = String.escaped (to_string s)
|
let printer s = String.escaped (to_string s)
|
||||||
let pp_uchar (c:Uchar.t) = Printf.sprintf "0x%x" (Uchar.to_int c)
|
let pp_uchar (c:Uchar.t) = Printf.sprintf "0x%x" (Uchar.to_int c)
|
||||||
|
|
||||||
let uutf_is_valid s =
|
let uutf_is_valid s =
|
||||||
try
|
try
|
||||||
Uutf.String.fold_utf_8
|
Uutf.String.fold_utf_8
|
||||||
(fun () _ -> function
|
(fun () _ -> function
|
||||||
|
|
@ -248,7 +248,7 @@ let uutf_is_valid s =
|
||||||
with Exit ->
|
with Exit ->
|
||||||
false
|
false
|
||||||
|
|
||||||
let uutf_to_seq s f =
|
let uutf_to_seq s f =
|
||||||
Uutf.String.fold_utf_8
|
Uutf.String.fold_utf_8
|
||||||
(fun () _ -> function
|
(fun () _ -> function
|
||||||
| `Malformed _ -> f (Uchar.of_int 0xfffd)
|
| `Malformed _ -> f (Uchar.of_int 0xfffd)
|
||||||
|
|
@ -331,4 +331,4 @@ let uutf_to_seq s f =
|
||||||
else Q.Test.fail_reportf "uutf: '%s', containers: '%s', is_valid %B, uutf_is_valid %B"
|
else Q.Test.fail_reportf "uutf: '%s', containers: '%s', is_valid %B, uutf_is_valid %B"
|
||||||
(pp l_uutf) (pp l_co) (is_valid s) (uutf_is_valid s)
|
(pp l_uutf) (pp l_co) (is_valid s) (uutf_is_valid s)
|
||||||
)
|
)
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ type 'a printer = Format.formatter -> 'a -> unit
|
||||||
type 'a ktree = unit -> [`Nil | `Node of 'a * 'a ktree list]
|
type 'a ktree = unit -> [`Nil | `Node of 'a * 'a ktree list]
|
||||||
|
|
||||||
(* TODO
|
(* TODO
|
||||||
(** {2 Transient IDs} *)
|
(** {2 Transient IDs} *)
|
||||||
module Transient = struct
|
module Transient = struct
|
||||||
type state = { mutable frozen: bool }
|
type state = { mutable frozen: bool }
|
||||||
type t = Nil | St of state
|
type t = Nil | St of state
|
||||||
let empty = Nil
|
let empty = Nil
|
||||||
|
|
@ -39,8 +39,8 @@ module Transient = struct
|
||||||
freeze r;
|
freeze r;
|
||||||
raise e
|
raise e
|
||||||
exception Frozen
|
exception Frozen
|
||||||
end
|
end
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(* function array *)
|
(* function array *)
|
||||||
module A = struct
|
module A = struct
|
||||||
|
|
@ -133,7 +133,7 @@ type 'a t = {
|
||||||
(forall j>=i, sub[j].size<32^{n+1}-1)]
|
(forall j>=i, sub[j].size<32^{n+1}-1)]
|
||||||
(prefix of subs has size of complete binary tree; suffix has
|
(prefix of subs has size of complete binary tree; suffix has
|
||||||
smaller size (actually decreasing))
|
smaller size (actually decreasing))
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
|
||||||
let empty = {size=0; leaves=A.empty; subs=A.empty}
|
let empty = {size=0; leaves=A.empty; subs=A.empty}
|
||||||
|
|
@ -290,7 +290,7 @@ let rec map f m : _ t =
|
||||||
let f = Q.Fn.apply f in
|
let f = Q.Fn.apply f in
|
||||||
(List.map f l) = (of_list l |> map f |> to_list)
|
(List.map f l) = (of_list l |> map f |> to_list)
|
||||||
)
|
)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let append a b =
|
let append a b =
|
||||||
if is_empty b then a
|
if is_empty b then a
|
||||||
|
|
@ -300,7 +300,7 @@ let append a b =
|
||||||
Q.(pair (small_list int)(small_list int)) (fun (l1,l2) ->
|
Q.(pair (small_list int)(small_list int)) (fun (l1,l2) ->
|
||||||
(l1 @ l2) = (append (of_list l1)(of_list l2) |> to_list)
|
(l1 @ l2) = (append (of_list l1)(of_list l2) |> to_list)
|
||||||
)
|
)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let add_list v l = List.fold_left (fun v x -> push x v) v l
|
let add_list v l = List.fold_left (fun v x -> push x v) v l
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ type 'a printer = Format.formatter -> 'a -> unit
|
||||||
type 'a ktree = unit -> [`Nil | `Node of 'a * 'a ktree list]
|
type 'a ktree = unit -> [`Nil | `Node of 'a * 'a ktree list]
|
||||||
|
|
||||||
(* TODO: restore this
|
(* TODO: restore this
|
||||||
(** {2 Transient Identifiers} *)
|
(** {2 Transient Identifiers} *)
|
||||||
module Transient : sig
|
module Transient : sig
|
||||||
type t
|
type t
|
||||||
(** Identifiers for transient modifications. A transient modification
|
(** Identifiers for transient modifications. A transient modification
|
||||||
is uniquely identified by a [Transient.t]. Once [Transient.freeze r]
|
is uniquely identified by a [Transient.t]. Once [Transient.freeze r]
|
||||||
|
|
@ -46,7 +46,7 @@ module Transient : sig
|
||||||
|
|
||||||
exception Frozen
|
exception Frozen
|
||||||
(** Raised when a frozen ID is used. *)
|
(** Raised when a frozen ID is used. *)
|
||||||
end
|
end
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(** {2 Signature} *)
|
(** {2 Signature} *)
|
||||||
|
|
@ -92,19 +92,19 @@ val choose : 'a t -> 'a option
|
||||||
|
|
||||||
(* TODO
|
(* TODO
|
||||||
|
|
||||||
val push_mut : id:Transient.t -> 'a -> 'a t -> 'a t
|
val push_mut : id:Transient.t -> 'a -> 'a t -> 'a t
|
||||||
(** [add_mut ~id k v m] behaves like [add k v m], except it will mutate
|
(** [add_mut ~id k v m] behaves like [add k v m], except it will mutate
|
||||||
in place whenever possible. Changes done with an [id] might affect all
|
in place whenever possible. Changes done with an [id] might affect all
|
||||||
versions of the structure obtained with the same [id] (but not
|
versions of the structure obtained with the same [id] (but not
|
||||||
other versions).
|
other versions).
|
||||||
@raise Transient.Frozen if [id] is frozen. *)
|
@raise Transient.Frozen if [id] is frozen. *)
|
||||||
|
|
||||||
val pop_mut : id:Transient.t -> 'a t -> 'a * 'a t
|
val pop_mut : id:Transient.t -> 'a t -> 'a * 'a t
|
||||||
(** Same as {!remove}, but modifies in place whenever possible.
|
(** Same as {!remove}, but modifies in place whenever possible.
|
||||||
@raise Transient.Frozen if [id] is frozen. *)
|
@raise Transient.Frozen if [id] is frozen. *)
|
||||||
|
|
||||||
val append_mut : id:Transient.t -> into:'a t -> 'a t -> 'a t
|
val append_mut : id:Transient.t -> into:'a t -> 'a t -> 'a t
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(** {6 Conversions} *)
|
(** {6 Conversions} *)
|
||||||
|
|
||||||
|
|
@ -128,15 +128,15 @@ val to_gen : 'a t -> 'a gen
|
||||||
|
|
||||||
(* TODO
|
(* TODO
|
||||||
|
|
||||||
val add_list_mut : id:Transient.t -> 'a t -> 'a list -> 'a t
|
val add_list_mut : id:Transient.t -> 'a t -> 'a list -> 'a t
|
||||||
(** @raise Frozen if the ID is frozen. *)
|
(** @raise Frozen if the ID is frozen. *)
|
||||||
|
|
||||||
val add_seq_mut : id:Transient.t -> 'a t -> 'a sequence -> 'a t
|
val add_seq_mut : id:Transient.t -> 'a t -> 'a sequence -> 'a t
|
||||||
(** @raise Frozen if the ID is frozen. *)
|
(** @raise Frozen if the ID is frozen. *)
|
||||||
|
|
||||||
val add_gen_mut : id:Transient.t -> 'a t -> 'a gen -> 'a t
|
val add_gen_mut : id:Transient.t -> 'a t -> 'a gen -> 'a t
|
||||||
(** @raise Frozen if the ID is frozen. *)
|
(** @raise Frozen if the ID is frozen. *)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(** {6 IO} *)
|
(** {6 IO} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue