git.annexia.org
/
whenjobs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add filter_map utility.
[whenjobs.git]
/
lib
/
whenutils.ml
diff --git
a/lib/whenutils.ml
b/lib/whenutils.ml
index
1fbb1c6
..
8cab30e
100644
(file)
--- a/
lib/whenutils.ml
+++ b/
lib/whenutils.ml
@@
-30,6
+30,13
@@
end
module StringSet = Set.Make (String)
+let rec filter_map f = function
+ | [] -> []
+ | x :: xs ->
+ match f x with
+ | Some y -> y :: filter_map f xs
+ | None -> filter_map f xs
+
type whenexpr =
| Expr_bool of bool
| Expr_str of string