Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. open System
  2.  
  3. [<EntryPoint>]
  4. let main argv =
  5.  
  6. let rec mem list x =
  7. match list with
  8. | [] -> false
  9. | head :: tail ->
  10. if x = head then true
  11. else mem tail x
  12.  
  13. let removedupes list1 =
  14. let rec removeduprec list1 list2 =
  15. match list1 with
  16. | [] -> list2
  17. | head :: tail when mem list2 head = false -> removeduprec tail (list2 @ [head])
  18. | head :: tail -> removeduprec tail list2
  19. removeduprec list1 []
  20.  
  21. let s = Console.ReadLine()
  22. printfn "%s" (s |> Seq.toList |> removedupes |> List.toArray |> System.String)
  23.  
  24. 0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement