---------------------------------------------------------------------- exists (Lib) ---------------------------------------------------------------------- exists : ('a -> bool) -> 'a list -> bool SYNOPSIS Check if a predicate holds somewhere in a list. KEYWORDS list, predicate, search DESCRIBE An invocation {exists P l} returns true if {P} holds of some element of {l}. Since there are no elements of {[]}, {exists P []} always returns {false}. FAILURE When searching for an element of {l} that {P} holds of, it may happen that an application of {P} to an element of {l} raises an exception. In that case, {exists P l} raises an exception. EXAMPLE - exists (fn i => i mod 2 = 0) [1,3,4]; > val it = true : bool - exists (fn _ => raise Fail "") []; > val it = false : bool - exists (fn _ => raise Fail "") [1]; ! Uncaught exception: ! Fail "" SEEALSO Lib.all, Lib.first, Lib.tryfind. ----------------------------------------------------------------------