Skip to content

Instantly share code, notes, and snippets.

@rapha
Created September 13, 2011 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rapha/1214808 to your computer and use it in GitHub Desktop.
Save rapha/1214808 to your computer and use it in GitHub Desktop.
Ocaml hack to remove duplicate lines in input
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