Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
POTTIER Francois
alphaLib
Commits
3efe72c3
Commit
3efe72c3
authored
Feb 01, 2017
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added [Atom.Set.disjoint_union].
parent
6f4371d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/Atom.ml
src/Atom.ml
+13
-0
src/Atom.mli
src/Atom.mli
+5
-0
No files found.
src/Atom.ml
View file @
3efe72c3
...
...
@@ -139,6 +139,19 @@ module Set = struct
include
Set
.
Make
(
Order
)
(* Disjoint union. *)
exception
NonDisjointUnion
of
atom
let
disjoint_union
xs
ys
=
match
choose
(
inter
xs
ys
)
with
|
exception
Not_found
->
(* The intersection of [xs] and [ys] is empty. Return their union. *)
union
xs
ys
|
x
->
(* The intersection contains [x]. Raise an exception. *)
raise
(
NonDisjointUnion
x
)
(* Sets of atoms form a monoid under union. *)
class
[
'
z
]
monoid
=
object
...
...
src/Atom.mli
View file @
3efe72c3
...
...
@@ -28,6 +28,11 @@ val hash: atom -> int
module
Set
:
sig
include
Set
.
S
with
type
elt
=
atom
(* Disjoint union. *)
exception
NonDisjointUnion
of
atom
val
disjoint_union
:
t
->
t
->
t
(* Sets of atoms form a monoid under union. *)
class
[
'
z
]
monoid
:
object
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment