let rec remove_duplicate = function [] -> [] | head::tail -> let purged_list = List.find_all (fun x -> head <> x) tail in head::(remove_duplicate purged_list)