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/Util/interval-set-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/trunk/Util/interval-set-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1840 - (view) (download)
Original Path: sml/trunk/src/smlnj-lib/Util/interval-set-sig.sml

1 : jhr 1840 (* interval-set-sig.sml
2 :     *
3 :     * COPYRIGHT (c) 2005 John Reppy (http://www.cs.uchicago.edu/~jhr)
4 :     * All rights reserved.
5 :     *
6 :     * This signature is the interface to sets over a discrete ordered domain, where the
7 :     * sets are represented by intervals. It is meant for representing dense sets (e.g.,
8 :     * unicode character classes).
9 :     *)
10 :    
11 :     signature INTERVAL_SET =
12 :     sig
13 :    
14 :     structure D : INTERVAL_DOMAIN
15 :    
16 :     type item = D.point
17 :     type interval = (item * item)
18 :     type set
19 :    
20 :     (* the empty set and the set of all elements *)
21 :     val empty : set
22 :     val universe : set
23 :    
24 :     (* a set of a single element *)
25 :     val singleton : item -> set
26 :    
27 :     (* set the covers the given interval *)
28 :     val interval : item * item -> set
29 :    
30 :     val isEmpty : set -> bool
31 :     val isUniverse : set -> bool
32 :    
33 :     val member : set * item -> bool
34 :    
35 :     (* return a list of intervals that represents the set *)
36 :     val list : set -> interval list
37 :    
38 :     (* add a single element to the set *)
39 :     val add : set * item -> set
40 :     val add' : item * set -> set
41 :    
42 :     (* add an interval to the set *)
43 :     val addInterval : set * interval -> set
44 :     val addInterval' : interval * set -> set
45 :    
46 :     (* set operations *)
47 :     val complement : set -> set
48 :     val union : (set * set) -> set
49 :     val intersect : (set * set) -> set
50 :     val difference : (set * set) -> set
51 :    
52 :     (* iterators *)
53 :     val app : (interval -> unit) -> set -> unit
54 :     val foldl : (interval * 'a -> 'a) -> 'a -> set -> 'a
55 :     val foldr : (interval * 'a -> 'a) -> 'a -> set -> 'a
56 :     val filter : (interval -> bool) -> set -> set
57 :     val all : (interval -> bool) -> set -> bool
58 :     val exists : (interval -> bool) -> set -> bool
59 :    
60 :     (* ordering on sets *)
61 :     val compare : set * set -> order
62 :     val isSubset : set * set -> bool
63 :    
64 :     end

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