From 112ab4b1c396fc2117191297227d8e411f9b9bb3 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 19 Jan 2018 11:24:29 +0100 Subject: Better memory management --- src/tools.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/tools.ml') diff --git a/src/tools.ml b/src/tools.ml index 6dfe564..7f500bf 100755 --- a/src/tools.ml +++ b/src/tools.ml @@ -18,6 +18,12 @@ module Option = struct | None -> v | Some x -> x + let test f v = begin + match f v with + | Some x -> x + | None -> v + end + end @@ -97,7 +103,7 @@ module List = struct | [] -> raise Not_found | hd::tl -> begin match f hd with | Some x -> x - | None -> (find_map[@tailrec]) f tl + | None -> (find_map[@tailcall]) f tl end end -- cgit v1.2.3