let rec set_of_list xs = match xs with [] -> [] | x::xs' -> if (List.mem x xs) then (set_of_list xs') else x::(set_of_list xs')