package acgtk
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=5d380a947658fb1201895cb4cb449b1f60f54914c563e85181d628a89f045c1dd7b5b2226bb7865dd090f87caa9187e0ea6c7a4ee3dc3dda340d404c4e76c7c2
doc/acgtk.utilsLib/UtilsLib/Utils/index.html
Module UtilsLib.Utils
Source
This module provides some useful modules or functions
StringMap
is module for maps from strings
to type 'a
string_of_list sep to_string [a_1;...;a_n]
returns a string made of the strings to_string a_1
... to_string a_n
concatenated with the separator sep
between each of the elements (if the list is of length greater than 2)
val pp_list :
?sep:(unit, Format.formatter, unit, unit, unit, unit) format6 ->
?terminal:(unit, Format.formatter, unit, unit, unit, unit) format6 ->
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a list ->
unit
pp_list ~sep ppf fmt l
pretty prints on the formater fmt
the items of the list l
, each of them being pretty-printed by ppf
. Example usage: pp_list ~sep:",@\n" Format.pp_print_int Format.std_formatter [1;2;3]
val pp_list_i :
?sep:(unit, Format.formatter, unit, unit, unit, unit) format6 ->
?terminal:(unit, Format.formatter, unit, unit, unit, unit) format6 ->
(Format.formatter -> (int * 'a) -> unit) ->
Format.formatter ->
'a list ->
unit
pp_list_i ~sep ppf fmt l
pretty prints on the formater fmt
the items of the list l
, each of them, together with its position (starting at 1) being pretty-printed by ppf
.
pp_text fmt t
pretty prints on the formater fmt
the text of of the string t
.
intersperse sep [a_1;...;a_n]
returns a list where elements of the input list are interspersed with sep
as in a_1; sep; a_2; sep; ...; sep; a_n
.
cycle n xs
returns the first n
elements of the infinite list formed by cyclically repeating the elements of xs
. Returns the empty list if xs
is empty.
fold_left1 plus elems
sums up the elements in elems
using plus
. A generalization of List.fold_left from monoids to semigroups, where we don't have any neutral element. Assumes elems
is non-empty.
string_of_list_rev sep to_string [a_1;...;a_n]
returns a string made of the strings to_string a_n
... to_string a_1
concatenated with the separator sep
between each of the elements (if the list is of length greater than 2)
find_file f dirs
tries to find a file with the name f
in the directories listed in dirs
. If it finds it in dir
, it returns the full name Filename.concat dir f
. To check in the current directory, add ""
to the list. It tries in the directories of dirs
in this order and stops when it finds such a file. If it can't find any such file, raise the exception No_file(f,msg)
where msg
contains a string describing where the file f
was looked for.
This function is useless when Bolt log level is NONE
decompose ~input:i ~base:b
returns the decomposition of i
in the base b
as a list of integers (between 0
and b
).