let rec remove_doubles (l:'a list) = match l with | [] -> [] | x::c -> if(List.mem x c) then (remove_doubles c) else x::(remove_doubles c)