remove trailing whitespace

This commit is contained in:
Simon Cruanes 2015-03-02 23:39:10 +01:00
parent f24d03ddb9
commit ac180aa339
24 changed files with 40 additions and 40 deletions

View file

@ -273,7 +273,7 @@ module Coll = struct
S.cardinal set S.cardinal set
let choose_exn (type elt) c = 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 match c with
| List [] -> fail () | List [] -> fail ()
| List (x::_) -> x | List (x::_) -> x

View file

@ -81,7 +81,7 @@ module PMap : sig
@raise Not_found if the element is not present *) @raise Not_found if the element is not present *)
val size : (_,_) t -> int val size : (_,_) t -> int
val to_seq : ('a, 'b) t -> ('a * 'b) sequence val to_seq : ('a, 'b) t -> ('a * 'b) sequence
val to_list : ('a, 'b) t -> ('a * 'b) list val to_list : ('a, 'b) t -> ('a * 'b) list

View file

@ -215,7 +215,7 @@ let rec _exists2 p a1 a2 i1 i2 ~len =
(* shuffle a[i...j[ using the given int random generator (* shuffle a[i...j[ using the given int random generator
See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle *) 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 for k = j-1 downto i+1 do
let l = _rand_int (k+1) in let l = _rand_int (k+1) in
let tmp = a.(l) in let tmp = a.(l) in

View file

@ -61,7 +61,7 @@ let max (x : t) y =
let equal (a:float) b = a=b let equal (a:float) b = a=b
let hash = Hashtbl.hash let hash = Hashtbl.hash
let compare (a:float) b = Pervasives.compare a b let compare (a:float) b = Pervasives.compare a b
type 'a printer = Buffer.t -> 'a -> unit 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 pp buf = Printf.bprintf buf "%f"
let print fmt = Format.pp_print_float fmt let print fmt = Format.pp_print_float fmt
let sign (a:float) = let sign (a:float) =
if a < 0.0 then -1 if a < 0.0 then -1
else if a > 0.0 then 1 else if a > 0.0 then 1
else 0 else 0
let fsign a = let fsign a =

View file

@ -39,11 +39,11 @@ val nan : t
val max_value : t val max_value : t
val min_value : t val min_value : t
val max_finite_value : t val max_finite_value : t
val epsilon : float val epsilon : float
val is_nan : t -> bool val is_nan : t -> bool
val add : t -> t -> t val add : t -> t -> t
@ -51,7 +51,7 @@ val sub : t -> t -> t
val neg : t -> t val neg : t -> t
val abs : t -> t val abs : t -> t
val scale : t -> t -> t val scale : t -> t -> t
@ -61,7 +61,7 @@ val max : t -> t -> t
val equal : t -> t -> bool val equal : t -> t -> bool
val compare : float -> float -> int val compare : float -> float -> int
type 'a printer = Buffer.t -> 'a -> unit type 'a printer = Buffer.t -> 'a -> unit
type 'a formatter = Format.formatter -> 'a -> unit type 'a formatter = Format.formatter -> 'a -> unit
@ -95,7 +95,7 @@ val sign_exn : t -> int
val to_int : t -> int val to_int : t -> int
val of_int : int -> t val of_int : int -> t
val to_string : t -> string val to_string : t -> string
val of_string : string -> t val of_string : string -> t

View file

@ -126,7 +126,7 @@ module type S = sig
val equal : 'a equal -> 'a t equal 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 val print : key formatter -> 'a formatter -> 'a t formatter
end end
@ -237,7 +237,7 @@ module Make(H : HashedType) : S with type key = H.t = struct
(* no one will point to the new [t] *) (* no one will point to the new [t] *)
let t = ref (Table (Table.copy tbl)) in let t = ref (Table (Table.copy tbl)) in
t t
let iter t f = let iter t f =
let tbl = reroot t in let tbl = reroot t in
Table.iter f tbl 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 Printf.bprintf buf "%a -> %a" pp_k k pp_v v
); );
Buffer.add_string buf "}" Buffer.add_string buf "}"
let print pp_k pp_v fmt t = let print pp_k pp_v fmt t =
Format.pp_print_string fmt "{"; Format.pp_print_string fmt "{";
let first = ref true in let first = ref true in

View file

@ -133,7 +133,7 @@ module type S = sig
val equal : 'a equal -> 'a t equal 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 val print : key formatter -> 'a formatter -> 'a t formatter
end end

View file

@ -32,7 +32,7 @@ type 'a ord = 'a -> 'a -> int
type 'a printer = Buffer.t -> 'a -> unit type 'a printer = Buffer.t -> 'a -> unit
type 'a formatter = Format.formatter -> 'a -> unit type 'a formatter = Format.formatter -> 'a -> unit
type + 'a t = unit -> type + 'a t = unit ->
[ `Nil [ `Nil
| `Cons of 'a * 'a t | `Cons of 'a * 'a t
] ]

View file

@ -34,7 +34,7 @@ type 'a formatter = Format.formatter -> 'a -> unit
(** {2 Basics} *) (** {2 Basics} *)
type + 'a t = unit -> type + 'a t = unit ->
[ `Nil [ `Nil
| `Cons of 'a * 'a t | `Cons of 'a * 'a t
] ]

View file

@ -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 val nest : ('a, 's, 'b) t list -> ('a, 's list, 'b list) t
(** runs all automata in parallel on the input. (** 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 *) @raise Invalid_argument otherwise *)
val split : ('a, 's, 'b) t -> ('a, 's, ('b * 'b)) t val split : ('a, 's, 'b) t -> ('a, 's, ('b * 'b)) t

View file

@ -197,7 +197,7 @@ module Instance = struct
_schedule q (fun () -> O.send a.transitions (s, i, s', os)); _schedule q (fun () -> O.send a.transitions (s, i, s', os));
List.iter List.iter
(fun o -> _schedule q (fun () -> O.send a.o o)) (fun o -> _schedule q (fun () -> O.send a.o o))
os os
let _receive a i = let _receive a i =
let first = Queue.is_empty _q in let first = Queue.is_empty _q in

View file

@ -122,7 +122,7 @@ module Instance : sig
val create : f:('s, 'i, 'o) automaton -> 's -> ('s, 'i, 'o) t val create : f:('s, 'i, 'o) automaton -> 's -> ('s, 'i, 'o) t
(** [create ~f init] creates an instance of [f] with initial state (** [create ~f init] creates an instance of [f] with initial state
[init]. [init].
@param f the transition function @param f the transition function
@param init the initial state *) @param init the initial state *)
end end

View file

@ -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_} of the type ['a]. Combinators, listed in the next section (e.g., {!list_}
or {!pair}), are used to describe complicated structures from simpler or {!pair}), are used to describe complicated structures from simpler
ones. ones.
For instance, to serialize a value of type [(int * string) list]: For instance, to serialize a value of type [(int * string) list]:
{[let bij = Bij.(list_ (pair int_ string_));; {[let bij = Bij.(list_ (pair int_ string_));;

View file

@ -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 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 let to_seq set k = iter k set

View file

@ -415,7 +415,7 @@ let seq_head seq =
try try
seq (fun x -> r := Some x; raise ExitHead); None seq (fun x -> r := Some x; raise ExitHead); None
with ExitHead -> !r with ExitHead -> !r
(** Shortest path from the first node to the second one, according (** Shortest path from the first node to the second one, according
to the given (positive!) distance function. The path is reversed, to the given (positive!) distance function. The path is reversed,
ie, from the destination to the source. The int is the distance. *) 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) Node ((v1,v2), (l1,l2), edges)
and eq (v1,v2) (v1',v2') = and eq (v1,v2) (v1',v2') =
g1.eq v1 v1' && g2.eq v2 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 in
{ eq; hash; force; } { eq; hash; force; }

View file

@ -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 (** 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 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). components can be represented by a single value of type ('v,'e) t).
The default equality considered here is [(=)], and the default hash The default equality considered here is [(=)], and the default hash
function is {! Hashtbl.hash}. *) function is {! Hashtbl.hash}. *)
@ -168,8 +168,8 @@ val dijkstra : ('id, 'v, 'e) t ->
'id -> 'id -> 'id -> 'id ->
float * ('id, 'e) path float * ('id, 'e) path
(** Shortest path from the first node to the second one, according (** Shortest path from the first node to the second one, according
to the given (positive!) distance function. to the given (positive!) distance function.
[ignore] allows one to ignore some vertices during exploration. [ignore] allows one to ignore some vertices during exploration.
This raises Not_found if no path could be found. *) This raises Not_found if no path could be found. *)
val is_dag : ('id, _, _) t -> 'id -> bool val is_dag : ('id, _, _) t -> 'id -> bool

View file

@ -208,7 +208,7 @@ module Box = struct
w := max !w s.x; w := max !w s.x;
h := !h + s.y h := !h + s.y
) a; ) a;
{x= !w; y= !h;} {x= !w; y= !h;}
(* from a matrix [m] (line,column), return two arrays [lines] and [columns], (* from a matrix [m] (line,column), return two arrays [lines] and [columns],
with [col.(i)] being the start offset of column [i] and with [col.(i)] being the start offset of column [i] and
@ -244,7 +244,7 @@ module Box = struct
| Frame t -> | Frame t ->
let {x;y} = size t in let {x;y} = size t in
{ x=x+2; y=y+2; } { x=x+2; y=y+2; }
| Pad (dim, b') -> | Pad (dim, b') ->
let {x;y} = size b' in let {x;y} = size b' in
{ x=x+2*dim.x; y=y+2*dim.y; } { x=x+2*dim.x; y=y+2*dim.y; }
| Grid (style,m) -> | Grid (style,m) ->

View file

@ -50,7 +50,7 @@ val b : Box.t = <abstr>
[|"c"; "hello world"|] |]]) [|"c"; "hello world"|] |]])
);; );;
val b2 : PrintBox.Box.t = <abstr> val b2 : PrintBox.Box.t = <abstr>
# PrintBox.output stdout b2;; # PrintBox.output stdout b2;;
+--------------------+ +--------------------+
|I love|a|bbb | |I love|a|bbb |
|to |-+-----------| |to |-+-----------|

View file

@ -61,7 +61,7 @@ module PArray = struct
let get t i = let get t i =
match !t with match !t with
| Array a -> a.(i) | Array a -> a.(i)
| Diff _ -> | Diff _ ->
let a = reroot t in let a = reroot t in
a.(i) a.(i)
@ -157,7 +157,7 @@ module PBitVector = struct
(** Bitvector with all bits set to 0 *) (** Bitvector with all bits set to 0 *)
let clear bv = make 5 let clear bv = make 5
let set_true bv i = set bv i true let set_true bv i = set bv i true
let set_false bv i = set bv i false let set_false bv i = set bv i false
end end
@ -361,7 +361,7 @@ module Make(X : ID) : S with type elt = X.t = struct
and ib' = find_root uf ib in and ib' = find_root uf ib in
if ia' = ib' if ia' = ib'
then uf (* no change *) then uf (* no change *)
else else
(* data associated to both representatives *) (* data associated to both representatives *)
let data_a = get_data uf ia' in let data_a = get_data uf ia' in
let data_b = get_data uf ib' in let data_b = get_data uf ib' in

View file

@ -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 . *) (** This is largely inspired by https://ocaml.janestreet.com/?q=node/18 . *)
type t = { type t = {
mutable id : unit ref; mutable id : unit ref;
mutable store : unit -> unit; mutable store : unit -> unit;
} (** The universal type *) } (** The universal type *)
@ -41,7 +41,7 @@ type 'a embedding = {
(** Create a new embedding. Values packed by a given embedding can (** Create a new embedding. Values packed by a given embedding can
only be unpacked by the same embedding. *) only be unpacked by the same embedding. *)
let embed () = let embed () =
let id = ref () in (* unique ID of the embedding *) let id = ref () in (* unique ID of the embedding *)
let r = ref None in (* place to store values *) let r = ref None in (* place to store values *)
let pack a = (* pack the 'a value into a new univ cell *) let pack a = (* pack the 'a value into a new univ cell *)

View file

@ -57,7 +57,7 @@ module type S = sig
val find_all : pattern:pattern -> string -> int -> int gen val find_all : pattern:pattern -> string -> int -> int gen
(** Generator on all occurrences of the pattern *) (** Generator on all occurrences of the pattern *)
val seq : pattern:pattern -> string -> int -> int sequence val seq : pattern:pattern -> string -> int -> int sequence
(** iterate on matching positions *) (** iterate on matching positions *)

View file

@ -57,7 +57,7 @@ module type S = sig
val find_all : pattern:pattern -> string -> int -> int gen val find_all : pattern:pattern -> string -> int -> int gen
(** Generator on all occurrences of the pattern *) (** Generator on all occurrences of the pattern *)
val seq : pattern:pattern -> string -> int -> int sequence val seq : pattern:pattern -> string -> int -> int sequence
(** iterate on matching positions *) (** iterate on matching positions *)

View file

@ -196,7 +196,7 @@ module Make(Str : STRING) = struct
(* other transitions *) (* other transitions *)
if j < limit then begin if j < limit then begin
(* substitution *) (* 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 *) (* deletion in indexed string *)
add_transition i j (Upon (Any, i, j+1)); add_transition i j (Upon (Any, i, j+1));
(* addition to indexed string *) (* addition to indexed string *)

View file

@ -81,7 +81,7 @@ A possible use of the index could be:
{[ {[
open Batteries;; 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");; (fun i -> IO.read_all i |> String.nsplit ~by:"\\n");;
let words = List.map (fun s->s,s) words;; let words = List.map (fun s->s,s) words;;