Untitled

mail@pastecode.io avatar
unknown
ocaml
2 years ago
248 B
1
Indexable
Never
let rec member x = function
  | [] -> false
  | y::l ->
      if x = y then true
      else member x l;;

let rec inter xs ys =
  match xs with
    [] -> []
  | xs::xss when member xs ys -> xs :: inter xss ys
  | xs::xss -> inter xss ys;;