summaryrefslogtreecommitdiffstats
path: root/utils/misc.ml
diff options
context:
space:
mode:
Diffstat (limited to 'utils/misc.ml')
-rw-r--r--utils/misc.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/misc.ml b/utils/misc.ml
index 529484692..390abd799 100644
--- a/utils/misc.ml
+++ b/utils/misc.ml
@@ -54,6 +54,13 @@ let rec list_remove x = function
| hd :: tl ->
if hd = x then tl else hd :: list_remove x tl
+let rec split_last = function
+ [] -> assert false
+ | [x] -> ([], x)
+ | hd :: tl ->
+ let (lst, last) = split_last tl in
+ (hd :: lst, last)
+
(* Options *)
let may f = function