module Aux:sig..end
val pi : floatexception Timeout of string
type ('a, 'b) choice =
| |
Left of |
| |
Right of |
module Strings:Set.Swith type elt = string
val add_strings : string list -> Strings.t -> Strings.tval strings_of_list : string list -> Strings.tmodule Ints:Set.Swith type elt = int
val add_ints : int list -> Ints.t -> Ints.tval ints_of_list : int list -> Ints.tmodule StrMap:Map.Swith type key = string
val strmap_of_assoc : (string * 'a) list -> 'a StrMap.tval strmap_filter : (string -> 'a -> bool) -> 'a StrMap.t -> (string * 'a) listmodule IntMap:Map.Swith type key = int
val intmap_of_assoc : (int * 'a) list -> 'a IntMap.tval intmap_filter : (int -> 'a -> bool) -> 'a IntMap.t -> (int * 'a) listmodule BasicOperators:sig..end
val int_pow : int -> int -> intval is_digit : char -> boolval fst3 : 'a * 'b * 'c -> 'aval snd3 : 'a * 'b * 'c -> 'bval trd3 : 'a * 'b * 'c -> 'cval map_fst : ('a -> 'b) -> 'a * 'c -> 'b * 'cval map_snd : ('a -> 'b) -> 'c * 'a -> 'c * 'bval random_elem : 'a list -> 'aval concat_map : ('a -> 'b list) -> 'a list -> 'b listval map_prepend : 'a list -> ('b -> 'a) -> 'b list -> 'a list
Map a second list and prepend the result to the first list, in
reverse order. Tail-recursive.
val map_rev_prepend : 'a list -> ('b -> 'a) -> 'b list -> 'a listval map_some : ('a -> 'b option) -> 'a list -> 'b list
Find the first non-None element. Raise Not_found if none exists.
val find_some : ('a -> 'b option) -> 'a list -> 'bval map_reduce : ('a -> 'b * 'c) -> ('d -> 'c -> 'd) -> 'd -> 'a list -> ('b * 'd) listList.fold_left, therefore reverses the order. The
resulting keys are sorted in the Pervasives.compare order.val collect : ('a * 'b) list -> ('a * 'b list) listmap_reduce (fun x -> x) (fun y x->x::y) [].val repeating_key_sorted : ('a * 'b) list -> boolval concat_foldr : ('a -> 'b -> 'b list) -> 'a list -> 'b list -> 'b listconcat_foldr f (a::l) init = concat_map (f a) (concat_foldr f l init)val concat_foldl : ('a -> 'b -> 'b list) -> 'a list -> 'b list -> 'b listconcat_foldl f (a::l) init = concat_foldl f l (concat_map (f a) init)val list_rev_split : ?acc1:'a list -> ?acc2:'b list -> ('a * 'b) list -> 'a list * 'b listval list_remove : 'a -> 'a list -> 'a listval list_diff : 'a list -> 'a list -> 'a listList.filter (fun e -> not (List.mem e b)) a.val sorted_diff : 'a list -> 'a list -> 'a listAux.unique_sorted).val list_inter : 'a list -> 'a list -> 'a listlist_inter a b = List.filter (fun e -> List.mem e b) a.val list_init : (int -> 'a) -> int -> 'a listval sorted_inter : 'a list -> 'a list -> 'a listAux.unique_sorted).val sorted_merge : 'a list -> 'a list -> 'a listAux.unique_sorted).val merge : ?sorted:bool ->
cmp:('a -> 'a -> int) ->
merge:('a -> 'a -> 'a) -> 'a list -> 'a list -> 'a listcmp-sorted list.val sorted_multiset_union : ('a * int) list -> ('a * int) list -> ('a * int) listval rev_assoc : ('a * 'b) list -> 'b -> 'aval mem_rev_assoc : ('a * 'b) list -> 'b -> boolval rev_assoc_all : ('a * 'b) list -> 'b -> 'a listval assoc_all : 'a -> ('a * 'b) list -> 'b listval replace_assoc : 'a -> 'b -> ('a * 'b) list -> ('a * 'b) listval pop_assoc : 'a -> ('a * 'b) list -> 'b * ('a * 'b) listval pop_assq : 'a -> ('a * 'b) list -> 'b * ('a * 'b) listAux.pop_assoc, but uses physical equality. Tail-recursive.val update_assoc : 'a -> 'b -> ('b -> 'b) -> ('a * 'b) list -> ('a * 'b) listval cons : 'a -> 'a list -> 'a listcons e l = e::l.val some : 'a -> 'a optionval unsome : 'a option -> 'aval list_of_opt : 'a option -> 'a listval map_try : ('a -> 'b) -> 'a list -> 'b listf on the list collecting results whose computation does not
raise Not_found. Therefore map_try call cannot raise Not_found.val find_try : ('a -> 'b) -> 'a list -> 'bNot_found and return its result. Raises Not_found if
the function results in Not_found on all elements.val fold_left_try : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'af over the list collecting results whose computation does
not raise Not_found. Therefore fold_left_try call cannot raise
Not_found.val array_foldi_left : (int -> 'a -> 'b -> 'a) -> 'a -> 'b array -> 'aArray.fold_left, but with the element position passed.val power : ?timeout:(unit -> bool) -> 'a list -> 'b list -> ('a * 'b) list listpower dom img generates all functions with domain dom and
image img, as graphs. Tail recursive.val product : ?upto:int -> ?timeout:(unit -> bool) -> 'a list list -> 'a list listval product_size : 'a list list -> intval pairs : 'a list -> ('a * 'a) listval all_ntuples : ?timeout:(unit -> bool) -> 'a list -> int -> 'a list listnth cartesian power of the list. Tail recursive.val all_subsets : ?max_size:int -> 'a list -> 'a list listset of size up to max_size.val remove_one : 'a -> 'a list -> 'a listval remove_last : 'a list -> 'a listval insert_nth : int -> 'a -> 'a list -> 'a listnth element of a list (counting from zero). Raise
Not_found if the list has less than n elements (e.g. inserting
0th element to empty list is OK).val find_index : 'a -> 'a list -> intval pop_find : ('a -> bool) -> 'a list -> 'a * 'a listval maximal : ('a -> 'a -> bool) -> 'a list -> 'a listval maximal_o : ('a -> 'a -> bool) -> 'a list -> 'aval maximal_unique : ('a -> 'a -> bool) -> 'a list -> 'a listval add_to_maximal : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a listl2 already has only maximal elements,
add_to_maximal cmp l1 l2 computes maximal cmp (l1 @ l2).type 'a topol_sort_ops = {
|
rem_edge : |
(* | rem_edge a b removes a->b. | *) |
|
iter_outgoing : |
|||
|
no_incoming : |
|||
|
node_to_string : |
Aux.topol_sort.val topol_sort : 'a topol_sort_ops -> 'a list -> 'a listl where cmp a b = true means that there is
an arrow from a to b. Elements without incoming edges are first
and elements without outgoing edges are last. Returns None /
raises Not_found if a cycle is detected.
Implementation:
http://en.wikipedia.org/wiki/Topological_sort#Algorithms
val unique_sorted : ?cmp:('a -> 'a -> int) -> 'a list -> 'a listPervasives.compare. Not tail-recursive.val unique_append : 'a list -> 'a list -> 'a listunique_append l1 l2 appends elements not occurring in l2 to
it, without repeating elements.val unique : ('a -> 'a -> bool) -> 'a list -> 'a listn^2 algorithm. Currently not tail-recursive.)val not_unique : 'a list -> boolval take_n : int -> 'a list -> 'a listn elements of the given list, or less it the list does not
contain enough values.val take_n_with_rest : int -> 'a list -> 'a list * 'a listn elements of the given list, or less it the list does not
contain enough values. Return the rest-list as the second argument.val range : ?from:int -> int -> int listfrom (default 0) to k-1.val array_from_assoc : (int * 'a) list -> 'a array0..length-1 range; raises
Invalid_argument "Aux.array_from_assoc" otherwise.val array_map_some : ('a -> 'b option) -> 'a array -> 'b arrayval array_mapi_some : (int -> 'a -> 'b option) -> 'a array -> 'b arrayval array_map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c arrayInvalid_argument if the arrays are of different lengths.val array_for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> boolval array_fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b array -> 'c array -> 'aval array_fold_map2 : ('a -> 'b -> 'c -> 'a * 'd) -> 'a -> 'b array -> 'c array -> 'a * 'd arrayval array_combine : 'a array -> 'b array -> ('a * 'b) arrayInvalid_argument
"Aux.array_map2" if the arrays are of different lengths.val array_exists : ('a -> bool) -> 'a array -> boolval array_existsi : (int -> 'a -> bool) -> 'a array -> boolval array_mem : 'a -> 'a array -> boolval array_map_of_list : ('a -> 'b) -> 'a list -> 'b arrayArray.of_list (List.map f l)val array_argfind : ('a -> bool) -> 'a array -> intval array_argfindi : (int -> 'a -> bool) -> 'a array -> intval array_find_all : ('a -> bool) -> 'a array -> 'a listf holds.
Find all indices for which f holds.
val array_argfind_all : ('a -> bool) -> 'a array -> int listval array_for_all : ('a -> bool) -> 'a array -> boolval array_for_alli : (int -> 'a -> bool) -> 'a array -> boolval array_for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> boolInvalid_argument "Aux.array_for_all2" if
arrays are of different lengths.val array_iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unitInvalid_argument "Aux.array_iter2" if
arrays are of different lengths.val array_replace : 'a array -> int -> 'a -> 'a arrayarray with the ith element replaced by elem.val list_find_all_max : ('a -> 'a -> int) -> 'a list -> 'a list
Find all maximal elements in an array.
val array_find_all_max : ('a -> 'a -> int) -> 'a array -> 'a listval array_argfind_all_max : ('a -> 'a -> int) -> 'a array -> int listval neg : ('a -> bool) -> 'a -> boolneg f x = not (f x)val is_right : ('a, 'b) choice -> boolval partition_choice : ('a, 'b) choice list -> 'a list * 'b listLeft and
Right-tagged elements.val partition_map : ('a -> ('b, 'c) choice) -> 'a list -> 'b list * 'c list
val map_choice : ('a -> 'b) -> ('c -> 'd) -> ('a, 'c) choice -> ('b, 'd) choiceval map_option : ('a -> 'b) -> 'a option -> 'b optionNone case.val omap : 'b -> ('a -> 'b) -> 'a option -> 'bval transpose_lists : 'a list list -> 'a list listInvalid_argument "List.map2" when matrix is not rectangular.val fold_n : ('a -> 'a) -> 'a -> int -> 'an times: f^n(x).val not_conflicting_name : ?truncate:bool -> Strings.t -> string -> strings and not appearing in names. If
truncate is true, remove numbers from the end of s.val not_conflicting_names : ?truncate:bool -> string -> Strings.t -> 'a list -> string listn strings proloning s and not appearing in names.val list_fprint : (Pervasives.out_channel -> 'a -> unit) ->
Pervasives.out_channel -> 'a list -> unitval array_fprint : (Pervasives.out_channel -> 'a -> unit) ->
Pervasives.out_channel -> 'a array -> unitval fprint_sep_list : ?newline:int ->
string ->
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unitval is_uppercase : char -> boolval is_lowercase : char -> boolval is_digit : char -> boolval is_letter : char -> boolval is_alphanum : char -> boolval is_space : char -> boolval clean_name : string -> strings to use only alphanumeric characters and underscore
and to start with a lowercase letter. *val strip_charprop : (char -> bool) -> string -> stringf from left and right of a string.val strip_spaces : string -> stringval split_charprop : ?keep_split_chars:bool -> (char -> bool) -> string -> string listf.type split_result =
| |
Text of |
| |
Delim of |
val split_chars_after : char -> char list -> string -> split_result listl after c, split on such pairs. *val split_spaces : string -> string listval split_newlines : string -> string listval split_empty_lines : string -> string listval normalize_spaces : string -> stringval replace_charprop : (char -> bool) -> string -> string -> stringf by repl.val str_index : ?from:int -> string -> string -> intfrom count. If it does not occur, raise Not_found.val str_contains : string -> string -> boolval str_subst_once : string -> string -> string -> stringval str_subst_all : string -> string -> string -> stringval str_subst_once_from_to : string -> string -> string -> string -> stringval str_subst_all_from_to : string -> string -> string -> string -> stringmodule type PRIOQUEUE =sig..end
module SimplePrioQueue:PRIOQUEUE
module LeftistPrioQueue:PRIOQUEUE