aboutsummaryrefslogtreecommitdiff
path: root/lib/util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.ml')
-rw-r--r--lib/util.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 2a60ad7b02..549b79e786 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -863,6 +863,10 @@ let list_cartesians op init ll =
let list_combinations l = list_cartesians (fun x l -> x::l) [] l
+(* Drop the last element of a list *)
+
+let rec list_drop_last = function [] -> assert false | hd :: [] -> [] | hd :: tl -> hd :: list_drop_last tl
+
(* Arrays *)
let array_exists f v =