summaryrefslogtreecommitdiff
path: root/src/util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.ml')
-rw-r--r--src/util.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.ml b/src/util.ml
index c89cc1ef..335fd36f 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -86,6 +86,15 @@
(* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
(**************************************************************************)
+let rec last = function
+ | [x] -> x
+ | _ :: xs -> last xs
+ | [] -> raise (Failure "last")
+
+let rec butlast = function
+ | [x] -> []
+ | x :: xs -> x :: butlast xs
+ | [] -> []
module Duplicate(S : Set.S) = struct