aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/list_util.sml
diff options
context:
space:
mode:
Diffstat (limited to 'src/list_util.sml')
-rw-r--r--src/list_util.sml13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/list_util.sml b/src/list_util.sml
index eee8249b..626d0ec0 100644
--- a/src/list_util.sml
+++ b/src/list_util.sml
@@ -60,4 +60,17 @@ fun mapfold f =
mf
end
+fun search f =
+ let
+ fun s ls =
+ case ls of
+ [] => NONE
+ | h :: t =>
+ case f h of
+ NONE => s t
+ | v => v
+ in
+ s
+ end
+
end