From ac180aa339410a03e1c9c5b893a2793da3b8c465 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 2 Mar 2015 23:39:10 +0100 Subject: [PATCH] remove trailing whitespace --- src/advanced/CCLinq.ml | 2 +- src/advanced/CCLinq.mli | 2 +- src/core/CCArray.ml | 2 +- src/core/CCFloat.ml | 8 ++++---- src/core/CCFloat.mli | 10 +++++----- src/data/CCPersistentHashtbl.ml | 6 +++--- src/data/CCPersistentHashtbl.mli | 2 +- src/iter/CCKList.ml | 2 +- src/iter/CCKList.mli | 2 +- src/misc/CSM.mli | 2 +- src/misc/automaton.ml | 2 +- src/misc/automaton.mli | 2 +- src/misc/bij.mli | 2 +- src/misc/hashset.ml | 2 +- src/misc/lazyGraph.ml | 4 ++-- src/misc/lazyGraph.mli | 6 +++--- src/misc/printBox.ml | 4 ++-- src/misc/printBox.mli | 2 +- src/misc/puf.ml | 6 +++--- src/misc/univ.ml | 4 ++-- src/string/KMP.ml | 2 +- src/string/KMP.mli | 2 +- src/string/levenshtein.ml | 2 +- src/string/levenshtein.mli | 2 +- 24 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/advanced/CCLinq.ml b/src/advanced/CCLinq.ml index fd2e79a1..6bbccd6f 100644 --- a/src/advanced/CCLinq.ml +++ b/src/advanced/CCLinq.ml @@ -273,7 +273,7 @@ module Coll = struct S.cardinal set let choose_exn (type elt) c = - let fail () = _exit_with_error "choose: empty collection" in + let fail () = _exit_with_error "choose: empty collection" in match c with | List [] -> fail () | List (x::_) -> x diff --git a/src/advanced/CCLinq.mli b/src/advanced/CCLinq.mli index 3195427b..3712b9f8 100644 --- a/src/advanced/CCLinq.mli +++ b/src/advanced/CCLinq.mli @@ -81,7 +81,7 @@ module PMap : sig @raise Not_found if the element is not present *) val size : (_,_) t -> int - + val to_seq : ('a, 'b) t -> ('a * 'b) sequence val to_list : ('a, 'b) t -> ('a * 'b) list diff --git a/src/core/CCArray.ml b/src/core/CCArray.ml index faeb7a4c..bf783639 100644 --- a/src/core/CCArray.ml +++ b/src/core/CCArray.ml @@ -215,7 +215,7 @@ let rec _exists2 p a1 a2 i1 i2 ~len = (* shuffle a[i...j[ using the given int random generator See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle *) -let _shuffle _rand_int a i j = +let _shuffle _rand_int a i j = for k = j-1 downto i+1 do let l = _rand_int (k+1) in let tmp = a.(l) in diff --git a/src/core/CCFloat.ml b/src/core/CCFloat.ml index ad8ad32b..010e3882 100644 --- a/src/core/CCFloat.ml +++ b/src/core/CCFloat.ml @@ -61,7 +61,7 @@ let max (x : t) y = let equal (a:float) b = a=b -let hash = Hashtbl.hash +let hash = Hashtbl.hash let compare (a:float) b = Pervasives.compare a b type 'a printer = Buffer.t -> 'a -> unit @@ -71,9 +71,9 @@ type 'a random_gen = Random.State.t -> 'a let pp buf = Printf.bprintf buf "%f" let print fmt = Format.pp_print_float fmt -let sign (a:float) = - if a < 0.0 then -1 - else if a > 0.0 then 1 +let sign (a:float) = + if a < 0.0 then -1 + else if a > 0.0 then 1 else 0 let fsign a = diff --git a/src/core/CCFloat.mli b/src/core/CCFloat.mli index bf1cd0f3..d682c195 100644 --- a/src/core/CCFloat.mli +++ b/src/core/CCFloat.mli @@ -39,11 +39,11 @@ val nan : t val max_value : t val min_value : t -val max_finite_value : t +val max_finite_value : t val epsilon : float -val is_nan : t -> bool +val is_nan : t -> bool val add : t -> t -> t @@ -51,7 +51,7 @@ val sub : t -> t -> t val neg : t -> t -val abs : t -> t +val abs : t -> t val scale : t -> t -> t @@ -61,7 +61,7 @@ val max : t -> t -> t val equal : t -> t -> bool -val compare : float -> float -> int +val compare : float -> float -> int type 'a printer = Buffer.t -> 'a -> unit type 'a formatter = Format.formatter -> 'a -> unit @@ -95,7 +95,7 @@ val sign_exn : t -> int val to_int : t -> int val of_int : int -> t -val to_string : t -> string +val to_string : t -> string val of_string : string -> t diff --git a/src/data/CCPersistentHashtbl.ml b/src/data/CCPersistentHashtbl.ml index 878f76ba..9983ad98 100644 --- a/src/data/CCPersistentHashtbl.ml +++ b/src/data/CCPersistentHashtbl.ml @@ -126,7 +126,7 @@ module type S = sig val equal : 'a equal -> 'a t equal - val pp : key printer -> 'a printer -> 'a t printer + val pp : key printer -> 'a printer -> 'a t printer val print : key formatter -> 'a formatter -> 'a t formatter end @@ -237,7 +237,7 @@ module Make(H : HashedType) : S with type key = H.t = struct (* no one will point to the new [t] *) let t = ref (Table (Table.copy tbl)) in t - + let iter t f = let tbl = reroot t in Table.iter f tbl @@ -337,7 +337,7 @@ module Make(H : HashedType) : S with type key = H.t = struct Printf.bprintf buf "%a -> %a" pp_k k pp_v v ); Buffer.add_string buf "}" - + let print pp_k pp_v fmt t = Format.pp_print_string fmt "{"; let first = ref true in diff --git a/src/data/CCPersistentHashtbl.mli b/src/data/CCPersistentHashtbl.mli index 30b07f4e..30de0f03 100644 --- a/src/data/CCPersistentHashtbl.mli +++ b/src/data/CCPersistentHashtbl.mli @@ -133,7 +133,7 @@ module type S = sig val equal : 'a equal -> 'a t equal - val pp : key printer -> 'a printer -> 'a t printer + val pp : key printer -> 'a printer -> 'a t printer val print : key formatter -> 'a formatter -> 'a t formatter end diff --git a/src/iter/CCKList.ml b/src/iter/CCKList.ml index 4e253a1a..ce21dc6d 100644 --- a/src/iter/CCKList.ml +++ b/src/iter/CCKList.ml @@ -32,7 +32,7 @@ type 'a ord = 'a -> 'a -> int type 'a printer = Buffer.t -> 'a -> unit type 'a formatter = Format.formatter -> 'a -> unit -type + 'a t = unit -> +type + 'a t = unit -> [ `Nil | `Cons of 'a * 'a t ] diff --git a/src/iter/CCKList.mli b/src/iter/CCKList.mli index 2a268103..c675b1a5 100644 --- a/src/iter/CCKList.mli +++ b/src/iter/CCKList.mli @@ -34,7 +34,7 @@ type 'a formatter = Format.formatter -> 'a -> unit (** {2 Basics} *) -type + 'a t = unit -> +type + 'a t = unit -> [ `Nil | `Cons of 'a * 'a t ] diff --git a/src/misc/CSM.mli b/src/misc/CSM.mli index 476ef889..40b6c7b2 100644 --- a/src/misc/CSM.mli +++ b/src/misc/CSM.mli @@ -71,7 +71,7 @@ val map_out : ('b -> 'b2) -> ('a, 's, 'b) t -> ('a, 's, 'b2) t val nest : ('a, 's, 'b) t list -> ('a, 's list, 'b list) t (** runs all automata in parallel on the input. - The state must be a list of the same length as the list of automata. + The state must be a list of the same length as the list of automata. @raise Invalid_argument otherwise *) val split : ('a, 's, 'b) t -> ('a, 's, ('b * 'b)) t diff --git a/src/misc/automaton.ml b/src/misc/automaton.ml index c761fb0a..8f909e42 100644 --- a/src/misc/automaton.ml +++ b/src/misc/automaton.ml @@ -197,7 +197,7 @@ module Instance = struct _schedule q (fun () -> O.send a.transitions (s, i, s', os)); List.iter (fun o -> _schedule q (fun () -> O.send a.o o)) - os + os let _receive a i = let first = Queue.is_empty _q in diff --git a/src/misc/automaton.mli b/src/misc/automaton.mli index 005607aa..072da224 100644 --- a/src/misc/automaton.mli +++ b/src/misc/automaton.mli @@ -122,7 +122,7 @@ module Instance : sig val create : f:('s, 'i, 'o) automaton -> 's -> ('s, 'i, 'o) t (** [create ~f init] creates an instance of [f] with initial state [init]. - + @param f the transition function @param init the initial state *) end diff --git a/src/misc/bij.mli b/src/misc/bij.mli index 4bbc8756..f870d514 100644 --- a/src/misc/bij.mli +++ b/src/misc/bij.mli @@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. of the type ['a]. Combinators, listed in the next section (e.g., {!list_} or {!pair}), are used to describe complicated structures from simpler ones. - + For instance, to serialize a value of type [(int * string) list]: {[let bij = Bij.(list_ (pair int_ string_));; diff --git a/src/misc/hashset.ml b/src/misc/hashset.ml index 110e4994..62e642bd 100644 --- a/src/misc/hashset.ml +++ b/src/misc/hashset.ml @@ -49,7 +49,7 @@ let iter f set = PHashtbl.iter (fun x () -> f x) set let fold f acc set = PHashtbl.fold (fun acc x () -> f acc x) acc set -let filter p set = PHashtbl.filter (fun x () -> p x) set +let filter p set = PHashtbl.filter (fun x () -> p x) set let to_seq set k = iter k set diff --git a/src/misc/lazyGraph.ml b/src/misc/lazyGraph.ml index 6262096c..24d85f4a 100644 --- a/src/misc/lazyGraph.ml +++ b/src/misc/lazyGraph.ml @@ -415,7 +415,7 @@ let seq_head seq = try seq (fun x -> r := Some x; raise ExitHead); None with ExitHead -> !r - + (** Shortest path from the first node to the second one, according to the given (positive!) distance function. The path is reversed, ie, from the destination to the source. The int is the distance. *) @@ -555,7 +555,7 @@ let product g1 g2 = Node ((v1,v2), (l1,l2), edges) and eq (v1,v2) (v1',v2') = g1.eq v1 v1' && g2.eq v2 v2' - and hash (v1,v2) = ((g1.hash v1) * 65599) + g2.hash v2 + and hash (v1,v2) = ((g1.hash v1) * 65599) + g2.hash v2 in { eq; hash; force; } diff --git a/src/misc/lazyGraph.mli b/src/misc/lazyGraph.mli index 5c88d026..890f7671 100644 --- a/src/misc/lazyGraph.mli +++ b/src/misc/lazyGraph.mli @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (** This module serves to represent directed graphs in a lazy fashion. Such a graph is always accessed from a given initial node (so only connected components can be represented by a single value of type ('v,'e) t). - + The default equality considered here is [(=)], and the default hash function is {! Hashtbl.hash}. *) @@ -168,8 +168,8 @@ val dijkstra : ('id, 'v, 'e) t -> 'id -> 'id -> float * ('id, 'e) path (** Shortest path from the first node to the second one, according - to the given (positive!) distance function. - [ignore] allows one to ignore some vertices during exploration. + to the given (positive!) distance function. + [ignore] allows one to ignore some vertices during exploration. This raises Not_found if no path could be found. *) val is_dag : ('id, _, _) t -> 'id -> bool diff --git a/src/misc/printBox.ml b/src/misc/printBox.ml index 34141af2..c25c92ea 100644 --- a/src/misc/printBox.ml +++ b/src/misc/printBox.ml @@ -208,7 +208,7 @@ module Box = struct w := max !w s.x; h := !h + s.y ) a; - {x= !w; y= !h;} + {x= !w; y= !h;} (* from a matrix [m] (line,column), return two arrays [lines] and [columns], with [col.(i)] being the start offset of column [i] and @@ -244,7 +244,7 @@ module Box = struct | Frame t -> let {x;y} = size t in { x=x+2; y=y+2; } - | Pad (dim, b') -> + | Pad (dim, b') -> let {x;y} = size b' in { x=x+2*dim.x; y=y+2*dim.y; } | Grid (style,m) -> diff --git a/src/misc/printBox.mli b/src/misc/printBox.mli index 99e91ee5..69792dd6 100644 --- a/src/misc/printBox.mli +++ b/src/misc/printBox.mli @@ -50,7 +50,7 @@ val b : Box.t = [|"c"; "hello world"|] |]]) );; val b2 : PrintBox.Box.t = -# PrintBox.output stdout b2;; +# PrintBox.output stdout b2;; +--------------------+ |I love|a|bbb | |to |-+-----------| diff --git a/src/misc/puf.ml b/src/misc/puf.ml index d41e637f..2a338fd2 100644 --- a/src/misc/puf.ml +++ b/src/misc/puf.ml @@ -61,7 +61,7 @@ module PArray = struct let get t i = match !t with | Array a -> a.(i) - | Diff _ -> + | Diff _ -> let a = reroot t in a.(i) @@ -157,7 +157,7 @@ module PBitVector = struct (** Bitvector with all bits set to 0 *) let clear bv = make 5 - + let set_true bv i = set bv i true let set_false bv i = set bv i false end @@ -361,7 +361,7 @@ module Make(X : ID) : S with type elt = X.t = struct and ib' = find_root uf ib in if ia' = ib' then uf (* no change *) - else + else (* data associated to both representatives *) let data_a = get_data uf ia' in let data_b = get_data uf ib' in diff --git a/src/misc/univ.ml b/src/misc/univ.ml index 9bd62d5b..62ccb66b 100644 --- a/src/misc/univ.ml +++ b/src/misc/univ.ml @@ -27,7 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (** This is largely inspired by https://ocaml.janestreet.com/?q=node/18 . *) -type t = { +type t = { mutable id : unit ref; mutable store : unit -> unit; } (** The universal type *) @@ -41,7 +41,7 @@ type 'a embedding = { (** Create a new embedding. Values packed by a given embedding can only be unpacked by the same embedding. *) -let embed () = +let embed () = let id = ref () in (* unique ID of the embedding *) let r = ref None in (* place to store values *) let pack a = (* pack the 'a value into a new univ cell *) diff --git a/src/string/KMP.ml b/src/string/KMP.ml index 092528bb..bc603dc5 100644 --- a/src/string/KMP.ml +++ b/src/string/KMP.ml @@ -57,7 +57,7 @@ module type S = sig val find_all : pattern:pattern -> string -> int -> int gen (** Generator on all occurrences of the pattern *) - + val seq : pattern:pattern -> string -> int -> int sequence (** iterate on matching positions *) diff --git a/src/string/KMP.mli b/src/string/KMP.mli index 49ba791c..60e90dae 100644 --- a/src/string/KMP.mli +++ b/src/string/KMP.mli @@ -57,7 +57,7 @@ module type S = sig val find_all : pattern:pattern -> string -> int -> int gen (** Generator on all occurrences of the pattern *) - + val seq : pattern:pattern -> string -> int -> int sequence (** iterate on matching positions *) diff --git a/src/string/levenshtein.ml b/src/string/levenshtein.ml index cc4f9ade..b66a0671 100644 --- a/src/string/levenshtein.ml +++ b/src/string/levenshtein.ml @@ -196,7 +196,7 @@ module Make(Str : STRING) = struct (* other transitions *) if j < limit then begin (* substitution *) - add_transition i j (Upon (Any, i+1, j+1)); + add_transition i j (Upon (Any, i+1, j+1)); (* deletion in indexed string *) add_transition i j (Upon (Any, i, j+1)); (* addition to indexed string *) diff --git a/src/string/levenshtein.mli b/src/string/levenshtein.mli index 8db9fa5e..a22bbdeb 100644 --- a/src/string/levenshtein.mli +++ b/src/string/levenshtein.mli @@ -81,7 +81,7 @@ A possible use of the index could be: {[ open Batteries;; -let words = File.with_file_in "/usr/share/dict/english" +let words = File.with_file_in "/usr/share/dict/english" (fun i -> IO.read_all i |> String.nsplit ~by:"\\n");; let words = List.map (fun s->s,s) words;;