summaryrefslogtreecommitdiff
path: root/libs/util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'libs/util.ml')
-rw-r--r--libs/util.ml8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/util.ml b/libs/util.ml
index 494faac..97aa480 100644
--- a/libs/util.ml
+++ b/libs/util.ml
@@ -47,3 +47,11 @@ let uid =
let c = ref 0 in
fun () -> c := !c + 1; string_of_int !c
+(* On lists *)
+
+(* list_fold_op : ('a -> 'a -> 'a) -> 'a list -> 'a *)
+let rec list_fold_op op = function
+ | [] -> invalid_arg "list_fold_opt on empty list"
+ | [a] -> a
+ | x::q -> op x (list_fold_op op q)
+