Created
September 13, 2011 19:26
-
-
Save rapha/1214808 to your computer and use it in GitHub Desktop.
Ocaml hack to remove duplicate lines in input
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 rec next_line seen = | |
let line = read_line () in | |
if not (List.mem line seen) then print_endline line; | |
next_line (line :: seen) | |
in | |
try next_line [] with End_of_file -> () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment