Untitled
unknown
ocaml
4 years ago
335 B
6
Indexable
let rec member x = function
| [] -> false
| y::l ->
if x = y then true
else member x l;;
let rec inner_union xs ys u =
match xs with
[] -> u
| xs::xss when member xs ys && not(member xs u) -> inner_union xss ys (xs::u)
| xs::xss -> inner_union xss ys u;;
let union xs ys = inner_union xs ys [];;Editor is loading...