Advertisement
xavierm02

Untitled

Jul 13th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.30 KB | None | 0 0
  1. class ['a] union_set set1 set2 =
  2.   let _ = if set1#superset <> set2#superset then
  3.     failwith "The two sets given to union_set must be subsets of the same set."
  4.   else () in
  5.   object(self)
  6.     inherit ['a] subset
  7.       set1#superset
  8.       (fun x -> (set1#contains x) || (set2#contains x))
  9.   end
  10. ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement