include Set.Make(String) let list_of_csv x = Str.(split (regexp " *, *")) (String.trim x) let of_string x = of_list (list_of_csv x) let to_string ?(pre="") ?(sep=", ") s = let j a x = match a, x with "", _ -> x | _, "" -> a | _ -> a ^ sep ^ x in fold (fun x acc -> j acc x) s pre let query string = let partition (include_set, exclude_set) elt = if String.get elt 0 = '!' then (include_set, add String.(sub elt 1 (length elt - 1)) exclude_set) else (add elt include_set, exclude_set) in List.fold_left partition (empty, empty) @@ list_of_csv string let predicate (inc, exl) set = not (disjoint inc set) && disjoint exl set