package devkit
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=a39dbbce04bd5562a9b4443daf39c582
sha512=b10104b61384b2151521b785e7f3c3250134c75eae09b42cad69bc4a22a9a5e429beb891ee87cedf376c23d9c40f09d3f71c3fd48aa35df490c0f69dc17f3242
doc/devkit.core/Devkit_core/Action/index.html
Module Devkit_core.ActionSource
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 '#').
Moreover, comments are stripped from lines (all characters including and following a '#') and returned lines are trimmed.
config_lines file read file and return the config lines.
See make_config_lines for details on config lines.
Time utilities
Basic timer. Also allows recording a sequence of interesting times from the given start point. Can serialize recorded events to json
show speed per second with appropriate precision
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.