Advertisement
Guest User

Kuk

a guest
Mar 14th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.29 KB | None | 0 0
  1. let rec mem value (xs : int list) =
  2.     match xs with
  3.     | [] -> false
  4.     | x::xs when x = value -> true
  5.     | x::xs -> mem value xs
  6.  
  7. let rec union list1 list2 =
  8.     match list2 with
  9.     | [] -> list1
  10.     | x::xs when mem x list1 -> union list1 xs
  11.     | x::xs -> (union list1 xs) @ [x]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement