type 'a pervasives_ref = 'a Stdlib.refval pervasives_ref : 'a -> 'a Stdlib.refval pervasives_compare : 'a -> 'a -> intval (!) : 'a Stdlib.ref -> 'aval (+) : int -> int -> intval (-) : int -> int -> intThis module contains numerous utility functions on strings, lists, arrays, etc.
Mapping under pairs
val on_fst : ( 'a -> 'b ) -> ('a * 'c) -> 'b * 'cval on_snd : ( 'a -> 'b ) -> ('c * 'a) -> 'c * 'bval map_pair : ( 'a -> 'b ) -> ('a * 'a) -> 'b * 'bMapping under triplets
val on_pi1 : ( 'a -> 'b ) -> ('a * 'c * 'd) -> 'b * 'c * 'dval on_pi2 : ( 'a -> 'b ) -> ('c * 'a * 'd) -> 'c * 'b * 'dval on_pi3 : ( 'a -> 'b ) -> ('c * 'd * 'a) -> 'c * 'd * 'bProjections from triplets
val pi1 : ('a * 'b * 'c) -> 'aval pi2 : ('a * 'b * 'c) -> 'bval pi3 : ('a * 'b * 'c) -> 'cChars.
val is_letter : char -> boolval is_digit : char -> boolval is_ident_tail : char -> boolval is_blank : char -> boolEmpty type
module Empty : sig ... endStrings.
val subst_command_placeholder : string -> string -> stringSubstitute %s in the first chain by the second chain
Lists.
val (@) : 'a list -> 'a list -> 'a listArrays.
Sets.
Maps.
Matrices.
val matrix_transpose : 'a list list -> 'a list listFunctions.
val (%>) : ( 'a -> 'b ) -> ( 'b -> 'c ) -> 'a -> 'cLeft-to-right function composition:
f1 %> f2 is fun x -> f2 (f1 x).
f1 %> f2 %> f3 is fun x -> f3 (f2 (f1 x)).
f1 %> f2 %> f3 %> f4 is fun x -> f4 (f3 (f2 (f1 x)))
etc.
val const : 'a -> 'b -> 'aval iterate : ( 'a -> 'a ) -> int -> 'a -> 'aval repeat : int -> ( 'a -> unit ) -> 'a -> unitval app_opt : ( 'a -> 'a ) option -> 'a -> 'aDelayed computations.
type 'a delayed = unit -> 'aval delayed_force : 'a delayed -> 'aval try_finally : ( 'a -> 'b ) -> 'a -> ( 'c -> unit ) -> 'c -> 'btry_finally f x g y applies the main code f to x and returns the result after having applied the finalization code g to y. If the main code raises the exception exn, the finalization code is executed and exn is raised. If the finalization code itself fails, the exception returned is always the one from the finalization code. Credit X.Leroy, D.Remy.
Enriched exceptions
Misc.
type ('a, 'b) union = ( 'a, 'b ) CSig.union = | Inl of 'a |
| Inr of 'b | Union type |
module Union : sig ... endval map_union :
( 'a -> 'c ) ->
( 'b -> 'd ) ->
( 'a, 'b ) union ->
( 'c, 'd ) uniontype 'a until = 'a CSig.until = | Stop of 'a |
| Cont of 'a | Used for browsable-until structures. |
type ('a, 'b) eq = ( 'a, 'b ) CSig.eq = val sym : ( 'a, 'b ) eq -> ( 'b, 'a ) eqval open_utf8_file_in : string -> Stdlib.in_channelOpen an utf-8 encoded file and skip the byte-order mark if any.
val set_temporary_memory : unit -> ( 'a -> 'a ) * ( unit -> 'a )A trick which can typically be used to store on the fly the computation of values in the "when" clause of a "match" then retrieve the evaluated result in the r.h.s of the clause