summaryrefslogtreecommitdiff
path: root/src/util.ml
diff options
context:
space:
mode:
authorThomas Bauereiss2017-11-08 16:27:49 +0000
committerThomas Bauereiss2017-11-08 16:27:49 +0000
commit16272e084d118c1b72d7921455d023aaafbf3dd5 (patch)
treec982bbc3748a56e230880e54e57380bbdb2a049a /src/util.ml
parent275ded17e9d0824a932fe23607fe4f7d7b1da62f (diff)
Allow functions to be selectively declared external only for some backends
For example, val test = { ocaml: "test_ocaml" } : unit -> unit will only be external for OCaml. For other backends, it will have to be defined.
Diffstat (limited to 'src/util.ml')
-rw-r--r--src/util.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util.ml b/src/util.ml
index 335fd36f..59ba7026 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -216,6 +216,11 @@ let rec option_binop f x y = match x, y with
| Some x, Some y -> Some (f x y)
| _ -> None
+let rec option_these = function
+ | Some x :: xs -> x :: option_these xs
+ | None :: xs -> option_these xs
+ | [] -> []
+
let changed2 f g x h y =
match (g x, h y) with
| (None,None) -> None