Module Util

module Util: sig .. end
Various utility functions

val get_option : 'a option -> 'a
unwraps an option
val map_option : ('a -> 'b) -> 'a option -> 'b option
map a function over an option
val pow : int -> int -> int
pow a b returns a to the bth power
val replace : 'a array -> int -> ('a -> 'a) -> unit
replace arr i f replaces arr.(i) with f(arr.(i))
val power_of_two : int -> bool
return true if the argument is a power of two
val log : int -> int -> int
log a b returns log base a of b
val contains : within:string -> string -> bool
searches for a string within another string
val strip_spaces : string -> string
Strip spaces from the front and back
val hd_exn : 'a list -> 'a
Head of a list, or assertion failure
val pick : 'a list -> string -> ('a -> string) -> 'a
pick list partial to_string returns the element of list that matches partial. to_string is called to get the string representation of each member of list.
val id : 'a -> 'a
The identity function
val filter_then_map : mapf:('a -> 'b) -> filterf:('a -> bool) -> 'a list -> 'b list
First filter a list, then map over it