package acgtk
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=2743321ae4cc97400856eb503a876cbcbd08435ebc750276399a97481d001d41
md5=04c1e14f98e2c8fd966ef7ef30b38323
doc/acgtkLib.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)
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)
No_file (file_name,msg)
is raised when the file file_name
is not found in any of the directories given to the Utils.find_file
function with the message msg
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
).