-
-
Save rizo/d3bbecdeee3bc12a9a5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec elem x xs = | |
match xs with | |
| [] -> false | |
| y :: ys -> x = y || elem x ys | |
let rec uniques l = | |
let rec helper l acc = | |
match l with | |
| [] -> acc | |
| x :: xs -> | |
if elem x acc then | |
helper xs acc | |
else | |
helper xs (x :: acc) | |
in List.rev (helper l []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment