package links
module Functional : sig ... end
include module type of struct include Functional end
Functional combinators
"compose" operators (arrow indicates direction of composition)
Simulating infix function words (a la Haskell backticks)
module type OrderedShow = sig ... end
module type Map = sig ... end
module String : sig ... end
module Int : sig ... end
module IntPair : sig ... end
module Char : sig ... end
module Map : sig ... end
module type Set = sig ... end
module Set : sig ... end
module IntSet : sig ... end
module IntMap : sig ... end
module IntPairMap : sig ... end
module StringSet : sig ... end
module CharMap : sig ... end
type stringset = StringSet.t
val pp_stringset :
Ppx_deriving_runtime.Format.formatter ->
stringset ->
Ppx_deriving_runtime.unit
val show_stringset : stringset -> Ppx_deriving_runtime.string
module Typeable_stringset : Deriving_Typeable.Typeable with type a = stringset = Deriving_Typeable.Primitive_typeable(struct type t = stringset let magic = "stringset" end)*
type 'a stringmap = 'a StringMap.t
val pp_stringmap :
'a. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
Ppx_deriving_runtime.Format.formatter ->
'a stringmap ->
Ppx_deriving_runtime.unit
val show_stringmap :
'a. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
'a stringmap ->
Ppx_deriving_runtime.string
type intset = IntSet.t
val pp_intset :
Ppx_deriving_runtime.Format.formatter ->
intset ->
Ppx_deriving_runtime.unit
val show_intset : intset -> Ppx_deriving_runtime.string
type 'a intmap = 'a IntMap.t
val pp_intmap :
'a. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
Ppx_deriving_runtime.Format.formatter ->
'a intmap ->
Ppx_deriving_runtime.unit
val show_intmap :
'a. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
'a intmap ->
Ppx_deriving_runtime.string
val list_to_set : IntSet.elt list -> IntSet.t
module ListUtils : sig ... end
include module type of struct include ListUtils end
Lists
fromTo a b
is the list of consecutive integers starting with a
and ending with b-1
. Throws Invalid_argument "fromTo"
if b < a
.
all_equiv rel list
: given an equiv. rel'n rel
, determine whether all elements of list
are equivalent.
span pred list
: partition list
into an initial sublist satisfying pred
and the remainder.
groupBy rel list
: given a binary rel'n rel
, partition list
into chunks s.t. successive elements x
, y
in a chunk give the same value under rel
.
groupByPred pred
partitions list
into chunks where all elements in the chunk give the same value under pred
.
groupByPred'
: Alternate implementation of groupByPred.
unsnoc list
: Partition list
into its last element and all the others.
unsnoc_opt list
: Partition list
into its last element and all the others.
last_opt list
: Return the last element of a list, or None if the list is empty.
curtail list
: Return a copy of the list with the last element removed.
Convert a (bivalent) less-than function into a (three-valued) comparison function.
Remove duplicates from a list, using the given relation to determine `duplicates'
Collects only elements which are duplicate in the original list.
val push_back : 'a -> 'a list ref -> unit
val push_front : 'a -> 'a list ref -> unit
Filter on two lists and map them together. Equivalent to map -<- filter -<- zip precondition: the two lists must be the same length
module AList : sig ... end
include module type of struct include AList end
Association-list utilities
alistmap maps f on the contents-parts of the entries, producing a new alist
alistmap' produces an alist by applying f to each element of the alist--f should produce a new contents-part for the entry.
[map2alist f list]
makes an alist that maps [x]
to [f x]
for each item in [list]
. This is called the `graph' of f on the domain list
.
lookup_in alist
is a function that looks up its argument in alist
module StringUtils : sig ... end
include module type of struct include StringUtils end
Strings
Given a list-of-lists, groupingsToString
concatenates them using ", "
as the delimiter between elements and "; "
as the delimiter between lists.
File I/O utilities
val lines : in_channel -> string list
val call_with_open_infile : string -> ?binary:bool -> (in_channel -> 'a) -> 'a
val call_with_open_outfile :
string ->
?binary:bool ->
(out_channel -> 'a) ->
'a
Given a path name, possibly relative to CWD, return an absolute path to the same file.
3-way assoc-list
val pp_either :
'a 'b. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
(Ppx_deriving_runtime.Format.formatter -> 'b -> Ppx_deriving_runtime.unit) ->
Ppx_deriving_runtime.Format.formatter ->
('a, 'b) either ->
Ppx_deriving_runtime.unit
val show_either :
'a 'b. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
(Ppx_deriving_runtime.Format.formatter -> 'b -> Ppx_deriving_runtime.unit) ->
('a, 'b) either ->
Ppx_deriving_runtime.string
val inLeft : 'a -> ('a, 'b) either
val inRight : 'a -> ('b, 'a) either
val fromLeft : ('a, 'b) either -> 'a
val fromRight : ('a, 'b) either -> 'b
val either_partition : ('a -> ('b, 'c) either) -> 'a list -> 'b list * 'c list
This module isn't used but creates a dependency on deriving, which we would like to avoid module EitherMonad = Deriving_monad.MonadPlusUtils( struct type 'a m = (string, 'a) either let return v = Right v let (>>=) m k = match m with | Left _ as l -> l | Right r -> k r let fail msg = Left msg let (>>) x y = x >>= fun _ -> y let mzero = Left "no error" let mplus l r = match l with | Left _ -> r | m -> m end)*
module Queue : sig ... end
module OptionUtils : sig ... end
include module type of struct include OptionUtils end
val map_tryPick :
(StringMap.key -> 'a -> 'b option) ->
'a StringMap.t ->
'b option
Character Encoding
*
Read a three-digit octal escape sequence and return the corresponding char
val escape_regexp : Notfound.Str.regexp
Handle escape sequences in string literals.
xml_escape
, xml_unescape
Escape/unescape for XML escape sequences (e.g. &)
val gensym_counter : int ref
Any two calls to gensym
return distinct strings. The optional prefix
argument can be used to supply a prefix for the string.
gensym a new symbol for each item in the list and return the pairs of each item with its new name, always using the optional prefix
argument as the prefix if given. The "graph" of the gensym function, if you will.
Given a list of names, generate a fresh name for each and pair the old name with the new one.
System interaction
Get an environment variable, return Some x
if it is defined as x, or None
if it is not in the environment.
Get an environment variable, return its value if it is defined, or raise an exception if it is not in the environment.
module Buffer = Notfound.Buffer
module Hashtbl = Notfound.Hashtbl
module List = Notfound.List
module ListLabels = Notfound.ListLabels
module MoreLabels = Notfound.MoreLabels
module Str = Notfound.Str
module StringLabels = Notfound.StringLabels
module Sys = Notfound.Sys
module Unix = Notfound.Unix
module UnixLabels = Notfound.UnixLabels
module Printexc = Notfound.Printexc
val format_omission : Format.formatter -> unit
module Disk : sig ... end
module type GLOB_POLICY = sig ... end
module DefaultPolicy : GLOB_POLICY
module Glob : sig ... end
module LwtHelpers : sig ... end
module PolyBuffer : sig ... end
module CalendarShow : sig ... end
module UnixTimestamp : sig ... end
module IO : sig ... end