(* 9 *) fun x -> x (* 10 *) fun x y f -> f x = f y (* 11 *) compose (* 12 *) fun p x -> if p x then 0. else 1. (* 13 *) fun c1 c2-> fst c1 = snd c2 && snd c1 = fst c2 (* 14 *) type time = Time of int * int (* 15 *) let hour time = let Time(hour, _) = time in hour let minute time = let Time(_, minute) = time in minute (* 16 *) let noon = Time(12,0) let midnight = Time(0,0) (* 17 *) let time_inf time1 time2 = let h1, h2, m1, m2 = hour time1, hour time2, minute time1, minute time2 in h1 < h2 || h1 = h2 && m1 < m2 (* 18 *) let pm_p time = time_inf noon time && time_inf time midnight (* 19 *) let rec syracuse m n = if n = 0 then m else let u = syracuse m (n - 1) in if u mod 2 = 0 then u / 2 else 3 * u + 1 (* 20 *) let _ = syracuse 5 (* 21 *) let m_full multiplicity = fun e -> multiplicity (* 22 *) let m_adjoin e mset count = fun x -> let c = m_multiplicity x mset in if x = e then c + count else c (* 23 *) let m_union mset1 mset2 = fun x -> (m_multiplicity x mset1) + (m_multiplicity x mset2) (* 24 *) let m_count n mset = let rec aux n mset cpt = if n < 0 then cpt else aux (pred n) mset (m_multiplicity n mset + cpt) in aux n mset 0