Basic functions
Collection of abstract values
All abstract types should implement this signature
ABSTRACT type
Display a list of strings
Display a pretty list: "x";"y";"z"
-> "x, y and z".
"and" can be changed by specifying last
Removes consecutive duplicates in a list
Strip a string
Does a string starts with the given prefix ?
Does a string ends with the given suffix ?
Remove a prefix
Remove a suffix
Cut a string at the first occurence of the given char
Same as cut_at
, but starts from the right
Does a string contains the given chars ?
Split a string
left indenting. ~visual
can be used to indent eg. ANSI colored
strings and should correspond to the visible characters of s
right indenting
Cut a string
Remove from a c-separated list of string the one with the given prefix
split a c-separated list of string in two according to the first
occurrences of the string with the given prefix
. The list of
elements occurring before is returned in reverse order. If there are
other elements with the same prefix
they are kept in the second list.
if rsync -arv return 4 lines, this means that no files have changed
Filter and map
Insert a value in an ordered list
Lazy environment variable
Lazy environment
To use when catching default exceptions: ensures we don't catch fatal errors like C-c. try-with should _always_ (by decreasing order of preference):
Register a backtrace for when you need to process a finalizer (that internally uses exceptions) and then re-raise the same exception. To be printed by pretty_backtrace.
Return a pretty-printed backtrace
Prettify a local path (eg. replace /home/me/ by '~')
Function application (with lower priority) (predefined in OCaml 4.01+)
Pipe operator -- reverse application (predefined in OCaml 4.01+)
Function composition : (f @* g) x =~ f (g x)
Reverse function composition : (f @> g) x =~ g (f x)
When stdout
refers to a terminal, query the number of columns.
Otherwise return max_int
.
Get the output of uname -s
Get the output of uname -m
Guess the shell compat-mode
Guess the location of .profile
Like Pervasives.at_exit but with the possibility to call manually (eg. before exec())
Calls the functions registered in at_exit
/