# HG changeset patch # User Adam Chlipala # Date 1419363683 18000 # Node ID d9f918b79b5a8845a122b837095fa12cfadc89e0 # Parent 0d898b086bbeac92d3c355dcbc4d59b080ae86e2 List.mem diff -r 0d898b086bbe -r d9f918b79b5a lib/ur/list.ur --- a/lib/ur/list.ur Tue Dec 23 13:42:20 2014 -0500 +++ b/lib/ur/list.ur Tue Dec 23 14:41:23 2014 -0500 @@ -216,6 +216,16 @@ fold [] end +fun mem [a] (_ : eq a) (x : a) = + let + fun mm ls = + case ls of + [] => False + | y :: ls => y = x || mm ls + in + mm + end + fun find [a] f = let fun find' ls = diff -r 0d898b086bbe -r d9f918b79b5a lib/ur/list.urs --- a/lib/ur/list.urs Tue Dec 23 13:42:20 2014 -0500 +++ b/lib/ur/list.urs Tue Dec 23 14:41:23 2014 -0500 @@ -54,6 +54,8 @@ val foldlMap : a ::: Type -> b ::: Type -> c ::: Type -> (a -> b -> c * b) -> b -> t a -> t c * b +val mem : a ::: Type -> eq a -> a -> t a -> bool + val find : a ::: Type -> (a -> bool) -> t a -> option a val search : a ::: Type -> b ::: Type -> (a -> option b) -> t a -> option b