home
/
code
/
hope.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement hope_option:validate/2
[hope.git]
/
src
/
hope_list.erl
diff --git
a/src/hope_list.erl
b/src/hope_list.erl
index
abfb3d3
..
f179d1a
100644
(file)
--- a/
src/hope_list.erl
+++ b/
src/hope_list.erl
@@
-10,6
+10,7
@@
, map/3 % Tunable recursion limit
, map_rev/2
, map_slow/2
, map/3 % Tunable recursion limit
, map_rev/2
, map_slow/2
+ , first_match/2
]).
]).
@@
-102,3
+103,13
@@
unique_preserve_order(L) ->
end
end,
lists:reverse(lists:foldl(PrependIfNew, [], L)).
end
end,
lists:reverse(lists:foldl(PrependIfNew, [], L)).
+
+-spec first_match([{Tag, fun((A) -> boolean())}], A) ->
+ hope_option:t(Tag).
+first_match([], _) ->
+ none;
+first_match([{Tag, F} | Tests], X) ->
+ case F(X)
+ of true -> {some, Tag}
+ ; false -> first_match(Tests, X)
+ end.
This page took
0.027971 seconds
and
4
git commands to generate.