comparison lib/ur/list.ur @ 2095:d9f918b79b5a

List.mem
author Adam Chlipala <adam@chlipala.net>
date Tue, 23 Dec 2014 14:41:23 -0500
parents 146ec8e90063
children
comparison
equal deleted inserted replaced
2094:0d898b086bbe 2095:d9f918b79b5a
214 (y, st) => fold (y :: ls') st ls 214 (y, st) => fold (y :: ls') st ls
215 in 215 in
216 fold [] 216 fold []
217 end 217 end
218 218
219 fun mem [a] (_ : eq a) (x : a) =
220 let
221 fun mm ls =
222 case ls of
223 [] => False
224 | y :: ls => y = x || mm ls
225 in
226 mm
227 end
228
219 fun find [a] f = 229 fun find [a] f =
220 let 230 let
221 fun find' ls = 231 fun find' ls =
222 case ls of 232 case ls of
223 [] => None 233 [] => None