Date: Mon, 23 Sep 2002 16:21:25 -0400 (EDT) From: Li Liao > Can you explain the built-in function > List.exists > by giving example in ML syntax ? > > List.exists : ('a -> bool) -> 'a list -> bool > > What does it mean? Function List.exists takes two arguments: a function f (whose type is 'a -> bool) and a list, say mylist (whose elements have type 'a). List.exists will apply f to every element of mylist to see if there exists an element x of mylist that satisfies f (namely f x = true). If yes, List.exists return true, and false otherwise. Example: fun f x = if x = 1 then true else false; val mylist = [2, 3, 4, 5] List.exists f mylist; val mylist' = [1, 2, 3, 4]; List.exists f mylist'; I hope this is helpful. > > I have done only first question. Can we submit the hw1 next week? It is extended to next Tue. Please check the class bboard for the anouncement. Li