let (@@) = List.rev_append;; let rec list_rmap_aux f accu = function | [] -> accu | h::t -> list_rmap_aux f ((f h) :: accu) t ;; let list_rmap f l = list_rmap_aux f [] l;; let rec list_uniq_aux accu cur = function | [] -> cur :: accu | h::t -> if cur = h then list_uniq_aux accu cur t else list_uniq_aux (cur::accu) h t ;; let list_uniq = function | [] -> [] | a::t -> list_uniq_aux [] a t ;; let list_sortu l = let l = Sort.list (>) l in list_uniq l ;; let rec list_count_aux accu f = function | [] -> accu | h::t -> list_count_aux (if f h then accu+1 else accu) f t ;; let list_count f l = list_count_aux 0 f l;; let rec list_prefix n = function | [] -> [] | h::t -> if n = 0 then [] else h::(list_prefix (n-1) t) ;; let yourelate = ref false;; exception Timeout