3 * COPYRIGHT (c
) 1993 by AT
&T Bell Laboratories
. See COPYRIGHT file for details
.
5 * Signature for a set
of values
with an order relation
.
11 structure Key
: ORD_KEY
13 type item
= Key
.ord_key
19 val singleton
: item
-> set
20 (* Create a singleton set
*)
22 val add
: set
* item
-> set
23 val add
' : (item
* set
) -> set
26 val addList
: set
* item list
-> set
27 (* Insert items from list
. *)
29 val delete
: set
* item
-> set
30 (* Remove an item
. Raise NotFound
if not found
. *)
32 val member
: set
* item
-> bool
33 (* Return
true if and only
if item is an element
in the set
*)
35 val isEmpty
: set
-> bool
36 (* Return
true if and only
if the set is empty
*)
38 val equal
: (set
* set
) -> bool
39 (* Return
true if and only
if the two sets are equal
*)
41 val compare
: (set
* set
) -> order
42 (* does a lexical comparison
of two sets
*)
44 val isSubset
: (set
* set
) -> bool
45 (* Return
true if and only
if the first set is a subset
of the second
*)
47 val numItems
: set
-> int
48 (* Return the number
of items
in the table
*)
50 val listItems
: set
-> item list
51 (* Return an ordered list
of the items
in the set
*)
53 val union
: set
* set
-> set
56 val intersection
: set
* set
-> set
59 val difference
: set
* set
-> set
62 val map
: (item
-> item
) -> set
-> set
63 (* Create a new set by applying a map function to the elements
67 val app
: (item
-> unit
) -> set
-> unit
68 (* Apply a function to the entries
of the set
72 val foldl
: (item
* 'b
-> 'b
) -> 'b
-> set
-> 'b
73 (* Apply a folding function to the entries
of the set
77 val foldr
: (item
* 'b
-> 'b
) -> 'b
-> set
-> 'b
78 (* Apply a folding function to the entries
of the set
82 val partition
: (item
-> bool) -> set
-> (set
* set
)
84 val filter
: (item
-> bool) -> set
-> set
86 val exists
: (item
-> bool) -> set
-> bool
88 val find
: (item
-> bool) -> set
-> item option