diff options
author | 2011-07-24 15:47:09 -0400 | |
---|---|---|
committer | 2011-07-24 15:47:09 -0400 | |
commit | 3e2cd569c9b1e53abc04ef40a55a603484637123 (patch) | |
tree | 1eca16f08da61d48e50376918cdf6b1c4b0acb81 /lib/ur/list.ur | |
parent | d17559c6db3578eb7de33c555b348a627366ed37 (diff) |
List.find
Diffstat (limited to 'lib/ur/list.ur')
-rw-r--r-- | lib/ur/list.ur | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur index 32a9679c..2679d877 100644 --- a/lib/ur/list.ur +++ b/lib/ur/list.ur @@ -206,6 +206,20 @@ fun foldlMap [a] [b] [c] f = fold [] end +fun find [a] f = + let + fun find' ls = + case ls of + [] => None + | x :: ls => + if f x then + Some x + else + find' ls + in + find' + end + fun search [a] [b] f = let fun search' ls = |