package devkit
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=222f8ac131b1d970dab7eeb2714bfd6b9338b88b1082e6e01c136ae19e7eaef4
sha512=c9e6d93e3d21e5530c0f4d5baca51bf1f0a5d19248f8af7678d0665bb5cdf295d7aaaaa3e50eb2e44b8720e55097cc675af4dc8ec45acf9da39feb3eae1405d5
doc/devkit.core/Devkit_core/Action/index.html
Module Devkit_core.Action
Source
miscellaneous
period p f
timely p f
Combination of the above, see the code for more info.
Enum utilities
chunk_e n e
splits enum e
into chunks of n
elements each (except the last which can be shorter). NB the order in result is not specified
List utilities
find the minimum element in the list
list_uniq f l
list_sorted_uniq eq_f l
Get a random element from a list.
extract sublist from a list, e.g. slice 1 3 [0;1;2;3;4]
will return [1;2;3]
.
Partitioning a list into chunks
chunk n l
splits list l
into chunks of n
elements each (except the last which can be shorter). NB the order in result is not specified FIXME?
distribute n l
splits l
into n
chunks, does not preserve the order of the elements.
stable_partition l n
splits l
into n
chunks, preserves the order of the elements.
Array utilities
array_rfindi p a
array_rfind p a
array_iter_rev f a
calls f
on each elements of a
in reverse order.
shuffle ?state a
shuffles an array, giving a uniform random distribution.
array must be sorted
chunk_a n a
splits array a
into chunks of n
elements each (except the last which can be shorter), preserving the order of elements, i.e. reverse operation is Array.concat
DynArray utilities
Hashtbl utilities
hashtbl_find ht f_default k
associates f_default ()
to k
in ht
, if no previous association exists.
Gc / Memory utilities
Memory format parsing/pretty-printing
Parse memory size specification, accepts: MB KB 1MB 20gb
Pretty-print memory size in a way that can be parsed back by parse_bytes_unit
Pretty-printing
short human-readable display for memory measures
File IO
Counting bytes. Not closing underlying io.
Extracting lines from a file.
read lines from file skipping empty lines and comments (lines starting with '#')
Time utilities
Basic timer. Also allows recording a sequence of interesting times from the given start point. Can serialize recorded events to json (useful for Logstash events)
Log or time execution of a function
Comparison
Benchmarking functions
Command-line arguments
Does not contains Sys.argv.(0).
Misc.
name01 name02 name09 name10 name11
-> name0{1..2} name{09..11}
Exponential Weighted Moving Average (smooth) 0.05 < alpha < 0.15 (dynamic)
generates a string of n random bytes.
generates a string of n random ascii chars.