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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6158, Fri Apr 10 23:22:07 2020 UTC revision 6159, Sat Apr 11 13:14:51 2020 UTC
# Line 20  Line 20 
20      val singleton : 'a obj -> 'a set      val singleton : 'a obj -> 'a set
21          (* Create a singleton set *)          (* Create a singleton set *)
22    
23        val fromList : 'a obj list -> 'a set
24            (* create a set from a list of items *)
25    
26      val add  : 'a set * 'a obj -> 'a set      val add  : 'a set * 'a obj -> 'a set
27      val add' : ('a obj * 'a set) -> 'a set      val add' : ('a obj * 'a set) -> 'a set
28          (* Insert an item. *)          (* Insert an 'a obj. *)
29    
30      val addList : 'a set * 'a obj list -> 'a set      val addList : 'a set * 'a obj list -> 'a set
31          (* Insert items from list. *)          (* Insert items from list. *)
32    
33        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      val delete : 'a set * 'a obj -> 'a set      val delete : 'a set * 'a obj -> 'a set
41          (* Remove an item. Raise NotFound if not found. *)          (* Remove an 'a obj. Raise NotFound if not found. *)
42    
43      val member : 'a set * 'a obj -> bool      val member : 'a set * 'a obj -> bool
44          (* Return true if and only if item is an element in the set *)          (* Return true if and only if 'a obj is an element in the set *)
45    
46      val isEmpty : 'a set -> bool      val isEmpty : 'a set -> bool
47          (* Return true if and only if the set is empty *)          (* Return true if and only if the set is empty *)
# Line 45  Line 55 
55      val isSubset : ('a set * 'a set) -> bool      val isSubset : ('a set * 'a set) -> bool
56          (* Return true if and only if the first set is a subset of the second *)          (* Return true if and only if the first set is a subset of the second *)
57    
58        val disjoint : 'a set * 'a set -> bool
59            (* are the two sets disjoint? *)
60    
61      val numItems : 'a set ->  int      val numItems : 'a set ->  int
62          (* Return the number of items in the table *)          (* Return the number of items in the table *)
63    
64      val listItems : 'a set -> 'a obj list      val toList : 'a set -> 'a obj list
65          (* Return an ordered list of the items in the set *)          (* Return an ordered list of the items in the set *)
66    
67        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      val union : 'a set * 'a set -> 'a set      val union : 'a set * 'a set -> 'a set
73          (* Union *)          (* Union *)
74    
# Line 75  Line 93 
93           * in decreasing order           * in decreasing order
94           *)           *)
95    
96      val foldl : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b      val fold : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b
97          (* Apply a folding function to the entries of the set          (* Apply a folding function to the entries of the set *)
          * in increasing order  
          *)  
98    
99        val foldl : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b
100      val foldr : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b      val foldr : ('a obj * 'b -> 'b) -> 'b -> 'a set -> 'b
101          (* Apply a folding function to the entries of the set          (* these functions are DEPRECATED *)
          * in decreasing order  
          *)  
102    
103      val partition : ('a obj -> bool) -> 'a set -> ('a set * 'a set)      val partition : ('a obj -> bool) -> 'a set -> ('a set * 'a set)
104            (* partition a set into two based using the given predicate.  Returns two
105             * sets, where the first contains those elements for which the predicate is
106             * true and the second contains those elements for which the predicate is
107             * false.
108             *)
109    
110      val filter : ('a obj -> bool) -> 'a set -> 'a set      val filter : ('a obj -> bool) -> 'a set -> 'a set
111            (* filter a set by the given predicate returning only those elements for
112             * which the predicate is true.
113             *)
114    
115        val all : ('a obj -> bool) -> 'a set -> bool
116            (* check the elements of a set with a predicate and return true if
117             * they all satisfy the predicate. Return false otherwise.
118             *)
119    
120      val exists : ('a obj -> bool) -> 'a set -> bool      val exists : ('a obj -> bool) -> 'a set -> bool
121            (* check the elements of a set with a predicate and return true if
122             * any element satisfies the predicate. Return false otherwise.
123             *)
124    
125      val find : ('a obj -> bool) -> 'a set -> 'a obj option      val find : ('a obj -> bool) -> 'a set -> 'a obj option
126            (* find an element in the set for which the predicate is true *)
127    
128    end    end

Legend:
Removed from v.6158  
changed lines
  Added in v.6159

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