1 (* Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
4 * MLton is released under a BSD
-style license
.
5 * See the file MLton
-LICENSE for details
.
8 structure S
= UnorderedUniverse(Integer
)
11 structure S
= SetEqual(structure Element
= Integer
)
15 val s
= listTo
[1, 2, 3, 4]
19 structure D
= DisjointMax(structure Label
= struct open Int open IU
end) ;
23 val ss
= LU
.mapFromTo
0 10 singleton
;
29 fun u i n
= update (s i
) n
;
30 fun l i j
= link (s i
) (s j
) ;
31 fun e i
= eval (s i
) ;
44 open DisjointCollection
;
46 val (c
, ss
) = new (LU
.fromTo
0 10) ;
48 fun s i
= LU
.nth ss i
;
49 fun r() = randomSet c
;
50 fun u i j
= union
c (s i
) (s j
) ;
52 fun v i
= value
c (s i
) ;
60 LU
.map (LU
.fromTo
0 10) v
;
74 val elts
= LU
.mapFromTo
0 9 singleton
;
76 val n
= ListUtil
.nth elts
;
77 fun e i j
= areEquivalent (n i
) (n j
) ;
78 fun u i j
= union (n i
) (n j
) ;
80 u
1 3 ; u
2 3 ; e
1 2 ;
86 u
2 4 ; u
1 4 ; u
1 3 ; e
1 2 ;