Module Misc

module Misc: sig .. end
The lexicographic order supported by the provided order. There is no constraint on the relative lengths of the lists.

val fatal_error : string -> 'a
val fatal_errorf : ('a, Format.formatter, unit, 'b) format4 -> 'a
exception Fatal_error
val try_finally : (unit -> 'a) -> (unit -> unit) -> 'a
val map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list
val map_left_right : ('a -> 'b) -> 'a list -> 'b list
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val replicate_list : 'a -> int -> 'a list
val list_remove : 'a -> 'a list -> 'a list
val split_last : 'a list -> 'a list * 'a
val may : ('a -> unit) -> 'a option -> unit
val may_map : ('a -> 'b) -> 'a option -> 'b option
module Stdlib: sig .. end
val find_in_path : string list -> string -> string
val find_in_path_rel : string list -> string -> string
val find_in_path_uncap : string list -> string -> string
val remove_file : string -> unit
val expand_directory : string -> string -> string
val create_hashtable : int -> ('a * 'b) list -> ('a, 'b) Hashtbl.t
val copy_file : in_channel -> out_channel -> unit
val copy_file_chunk : in_channel -> out_channel -> int -> unit
val string_of_file : in_channel -> string
val log2 : int -> int
val align : int -> int -> int
val no_overflow_add : int -> int -> bool
val no_overflow_sub : int -> int -> bool
val no_overflow_mul : int -> int -> bool
val no_overflow_lsl : int -> int -> bool
module Int_literal_converter: sig .. end
val chop_extension_if_any : string -> string
val chop_extensions : string -> string
val search_substring : string -> string -> int -> int
val replace_substring : before:string -> after:string -> string -> string
val rev_split_words : string -> string list
val get_ref : 'a list ref -> 'a list
val fst3 : 'a * 'b * 'c -> 'a
val snd3 : 'a * 'b * 'c -> 'b
val thd3 : 'a * 'b * 'c -> 'c
val fst4 : 'a * 'b * 'c * 'd -> 'a
val snd4 : 'a * 'b * 'c * 'd -> 'b
val thd4 : 'a * 'b * 'c * 'd -> 'c
val for4 : 'a * 'b * 'c * 'd -> 'd
module LongString: sig .. end
val edit_distance : string -> string -> int -> int option
edit_distance a b cutoff computes the edit distance between strings a and b. To help efficiency, it uses a cutoff: if the distance d is smaller than cutoff, it returns Some d, else None.

The distance algorithm currently used is Damerau-Levenshtein: it computes the number of insertion, deletion, substitution of letters, or swapping of adjacent letters to go from one word to the other. The particular algorithm may change in the future.

val spellcheck : string list -> string -> string list
spellcheck env name takes a list of names env that exist in the current environment and an erroneous name, and returns a list of suggestions taken from env, that are close enough to name that it may be a typo for one of them.
val did_you_mean : Format.formatter -> (unit -> string list) -> unit
did_you_mean ppf get_choices hints that the user may have meant one of the option returned by calling get_choices. It does nothing if the returned list is empty.

The unit -> ... thunking is meant to delay any potentially-slow computation (typically computing edit-distance with many things from the current environment) to when the hint message is to be printed. You should print an understandable error message before calling did_you_mean, so that users get a clear notification of the failure even if producing the hint is slow.

val split : string -> char -> string list
String.split string char splits the string string at every char char, and returns the list of sub-strings between the chars. String.concat (String.make 1 c) (String.split s c) is the identity.
Since 4.01
val cut_at : string -> char -> string * string
String.cut_at s c returns a pair containing the sub-string before the first occurrence of c in s, and the sub-string after the first occurrence of c in s. let (before, after) = String.cut_at s c in before ^ String.make 1 c ^ after is the identity if s contains c.

Raise Not_found if the character does not appear in the string
Since 4.01

module StringSet: Set.S  with type elt = string
module StringMap: Map.S  with type key = string
module Color: sig .. end
val normalise_eol : string -> string
normalise_eol s returns a fresh copy of s with any '\r' characters removed. Intended for pre-processing text which will subsequently be printed on a channel which performs EOL transformations (i.e. Windows)