Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /smlnj-lib/trunk/HashCons/hash-cons-set-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/trunk/HashCons/hash-cons-set-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6160 - (view) (download)

1 : jhr 967 (* hash-cons-set-sig.sml
2 :     *
3 : jhr 3580 * COPYRIGHT (c) 2011 The Fellowship of SML/NJ (http://www.smlnj.org)
4 :     * All rights reserved.
5 : jhr 967 *
6 :     * Finnite sets of hash-consed objects.
7 :     *)
8 :    
9 :    
10 :     signature HASH_CONS_SET =
11 :     sig
12 :    
13 :     type 'a obj = 'a HashCons.obj
14 :    
15 :     type 'a set
16 :    
17 :     val empty : 'a set
18 :     (* The empty set *)
19 :    
20 :     val singleton : 'a obj -> 'a set
21 :     (* Create a singleton set *)
22 :    
23 : jhr 6159 val fromList : 'a obj list -> 'a set
24 :     (* create a set from a list of items *)
25 :    
26 : jhr 967 val add : 'a set * 'a obj -> 'a set
27 :     val add' : ('a obj * 'a set) -> 'a set
28 : jhr 6159 (* Insert an 'a obj. *)
29 : jhr 967
30 :     val addList : 'a set * 'a obj list -> 'a set
31 :     (* Insert items from list. *)
32 :    
33 : jhr 6159 val subtract : 'a set * 'a obj -> 'a set
34 :     val subtract' : ('a obj * 'a set) -> 'a set
35 :     (* Subtract an 'a obj from a set; has no effect if the 'a obj is not in the set *)
36 :    
37 :     val subtractList : 'a set * 'a obj list -> 'a set
38 :     (* Subtract a list of items from the set. *)
39 :    
40 : jhr 967 val delete : 'a set * 'a obj -> 'a set
41 : jhr 6159 (* Remove an 'a obj. Raise NotFound if not found. *)
42 : jhr 967
43 :     val member : 'a set * 'a obj -> bool
44 : jhr 6159 (* Return true if and only if 'a obj is an element in the set *)
45 : jhr 967
46 :     val isEmpty : 'a set -> bool
47 :     (* Return true if and only if the set is empty *)
48 :    
49 :     val equal : ('a set * 'a set) -> bool
50 :     (* Return true if and only if the two sets are equal *)
51 :    
52 :     val compare : ('a set * 'a set) -> order
53 :     (* does a lexical comparison of two sets *)
54 :    
55 :     val isSubset : ('a set * 'a set) -> bool
56 :     (* Return true if and only if the first set is a subset of the second *)
57 :    
58 : jhr 6159 val disjoint : 'a set * 'a set -> bool
59 :     (* are the two sets disjoint? *)
60 :    
61 : jhr 967 val numItems : 'a set -> int
62 :     (* Return the number of items in the table *)
63 :    
64 : jhr 6159 val toList : 'a set -> 'a obj list
65 : jhr 967 (* Return an ordered list of the items in the set *)
66 :    
67 : jhr 6159 val listItems : 'a set -> 'a obj list
68 :     (* Return an ordered list of the items in the set. This function is
69 :     * deprecated in favor of `toList`
70 :     *)
71 :    
72 : jhr 967 val union : 'a set * 'a set -> 'a set
73 :     (* Union *)
74 :    
75 :     val intersection : 'a set * 'a set -> 'a set
76 :     (* Intersection *)
77 :    
78 :     val difference : 'a set * 'a set -> 'a set
79 :     (* Difference *)
80 :    
81 :     val map : ('a obj -> 'b obj) -> 'a set -> 'b set
82 :     (* Create a new set by applying a function to the elements
83 :     * of the set.
84 :     *)
85 :    
86 :     val mapPartial : ('a obj -> 'b obj option) -> 'a set -> 'b set
87 :     (* Create a new set by applying a partial function to the elements
88 :     * of the set.
89 :     *)
90 :    
91 :     val app : ('a obj -> unit) -> 'a set -> unit
92 : jhr 6160 (* Apply a function to the entries of the set *)
93 : jhr 967
94 : jhr 6159 val fold : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b
95 :     (* Apply a folding function to the entries of the set *)
96 :    
97 : jhr 967 val foldl : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b
98 :     val foldr : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b
99 : jhr 6159 (* these functions are DEPRECATED *)
100 : jhr 967
101 :     val partition : ('a obj -> bool) -> 'a set -> ('a set * 'a set)
102 : jhr 6159 (* partition a set into two based using the given predicate. Returns two
103 :     * sets, where the first contains those elements for which the predicate is
104 :     * true and the second contains those elements for which the predicate is
105 :     * false.
106 :     *)
107 : jhr 967
108 :     val filter : ('a obj -> bool) -> 'a set -> 'a set
109 : jhr 6159 (* filter a set by the given predicate returning only those elements for
110 :     * which the predicate is true.
111 :     *)
112 : jhr 967
113 : jhr 6159 val all : ('a obj -> bool) -> 'a set -> bool
114 :     (* check the elements of a set with a predicate and return true if
115 :     * they all satisfy the predicate. Return false otherwise.
116 :     *)
117 :    
118 : jhr 967 val exists : ('a obj -> bool) -> 'a set -> bool
119 : jhr 6159 (* check the elements of a set with a predicate and return true if
120 :     * any element satisfies the predicate. Return false otherwise.
121 :     *)
122 : jhr 967
123 :     val find : ('a obj -> bool) -> 'a set -> 'a obj option
124 : jhr 6159 (* find an element in the set for which the predicate is true *)
125 : jhr 967
126 :     end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0