Module AFTN.Utils

Standard utilities

val shuffle : 'a list -> 'a list

Shuffle a list

val select_random : 'a list -> 'a

Select an item from random in a list

val replacei : 'a list -> int -> 'a -> 'a list

Replace in a list by index

val replace : 'a list -> ('a -> bool) -> 'a -> 'a list

Replace in a list all items that satisfy a 'a -> bool function

val read_file_lines : string -> string list

Read and return the lines of a file

val range : int -> int -> int list

For bounds i and j, compute the list i..j, inclusive

val _update : ('a -> 'b) -> ('c -> 'a -> bool) -> 'c -> 'b -> 'a -> 'b

Functional map update

val update : ('a -> 'b) -> 'a -> 'b -> 'a -> 'b
val len_partition : 'a list -> int -> 'a list list
val transpose : 'a list list -> 'a list list