aboutsummaryrefslogtreecommitdiff
path: root/src/tools.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2018-01-19 11:24:29 +0100
committerSébastien Dailly <sebastien@chimrod.com>2018-01-25 17:17:15 +0100
commit112ab4b1c396fc2117191297227d8e411f9b9bb3 (patch)
treef6d06ef60c696b43d48e2cd8e2f7f426a03b3706 /src/tools.ml
parent098ac444e731d7674d8910264ae58fb876618a5a (diff)
Better memory management
Diffstat (limited to 'src/tools.ml')
-rwxr-xr-xsrc/tools.ml8
1 files changed, 7 insertions, 1 deletions
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