Created
August 15, 2014 16:57
-
-
Save alexwirz/a23cae6d471e7ab1efa3 to your computer and use it in GitHub Desktop.
This file contains 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 has number list = List.exists (fun elem -> elem = number) list | |
let rec distinct list = | |
match list with | |
[] -> [] | |
| x :: xs when has x xs -> distinct xs | |
| x :: xs -> x :: distinct xs | |
let l = [ 1; 2; 3; 1; 2; 1 ] | |
distinct l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment