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 /sml/trunk/src/smlnj-lib/HashCons/hash-cons-map-sig.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 967 - (view) (download)

1 : jhr 967 (* hash-cons-map-sig.sml
2 :     *
3 :     * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
4 :     *)
5 :    
6 :     signature HASH_CONS_MAP =
7 :     sig
8 :    
9 :     type 'a obj = 'a HashCons.obj
10 :    
11 :     type ('a, 'b) map
12 :    
13 :     val empty : ('a, 'b) map
14 :     (* The empty map *)
15 :    
16 :     val isEmpty : ('a, 'b) map -> bool
17 :     (* Return true if and only if the map is empty *)
18 :    
19 :     val singleton : ('a obj * 'b) -> ('a, 'b) map
20 :     (* return the specified singleton map *)
21 :    
22 :     val insert : ('a, 'b) map * 'a obj * 'b -> ('a, 'b) map
23 :     val insert' : (('a obj * 'b) * ('a, 'b) map) -> ('a, 'b) map
24 :     (* Insert an item. *)
25 :    
26 :     val insertWith : (('b * 'b) -> 'b)
27 :     -> ('a, 'b) map * 'a obj * 'b -> ('a, 'b) map
28 :     (* Insert an item with a combining function to resolve collisions.
29 :     * The first argument to the combining function is the existing value,
30 :     * and the second argument is the value being inserted into the map.
31 :     *)
32 :     val insertWithi : (('a obj * 'b * 'b) -> 'b)
33 :     -> ('a, 'b) map * 'a obj * 'b -> ('a, 'b) map
34 :     (* Like insertWith, except that the combining function also takes the
35 :     * key as an argument.
36 :     *)
37 :    
38 :     val find : ('a, 'b) map * 'a obj -> 'b option
39 :     (* Look for an item, return NONE if the item doesn't exist *)
40 :    
41 :     val inDomain : (('a, 'b) map * 'a obj) -> bool
42 :     (* return true, if the key is in the domain of the map *)
43 :    
44 :     val remove : ('a, 'b) map * 'a obj -> ('a, 'b) map * 'b
45 :     (* Remove an item, returning new map and value removed.
46 :     * Raises LibBase.NotFound if not found.
47 :     *)
48 :    
49 :     val first : ('a, 'b) map -> 'b option
50 :     val firsti : ('a, 'b) map -> ('a obj * 'b) option
51 :     (* return the first item in the map (or NONE if it is empty) *)
52 :    
53 :     val numItems : ('a, 'b) map -> int
54 :     (* Return the number of items in the map *)
55 :    
56 :     val listItems : ('a, 'b) map -> 'b list
57 :     val listItemsi : ('a, 'b) map -> ('a obj * 'b) list
58 :     (* Return an ordered list of the items (and their keys) in the map. *)
59 :    
60 :     val listKeys : ('a, 'b) map -> 'a obj list
61 :     (* return an ordered list of the keys in the map. *)
62 :    
63 :     val collate : ('b * 'b -> order) -> (('a, 'b) map * ('a, 'b) map) -> order
64 :     (* given an ordering on the map's range, return an ordering
65 :     * on the map.
66 :     *)
67 :    
68 :     val unionWith : ('b * 'b -> 'b) -> (('a, 'b) map * ('a, 'b) map)
69 :     -> ('a, 'b) map
70 :     val unionWithi : ('a obj * 'b * 'b -> 'b) -> (('a, 'b) map * ('a, 'b) map)
71 :     -> ('a, 'b) map
72 :     (* return a map whose domain is the union of the domains of the two input
73 :     * maps, using the supplied function to define the map on elements that
74 :     * are in both domains.
75 :     *)
76 :    
77 :     val intersectWith : ('b * 'c -> 'd) -> (('a, 'b) map * ('a, 'c) map)
78 :     -> ('a, 'd) map
79 :     val intersectWithi : ('a obj * 'b * 'c -> 'd) -> (('a, 'b) map * ('a, 'c) map)
80 :     -> ('a, 'd) map
81 :     (* return a map whose domain is the intersection of the domains of the
82 :     * two input maps, using the supplied function to define the range.
83 :     *)
84 :    
85 :     val app : ('b -> unit) -> ('a, 'b) map -> unit
86 :     val appi : (('a obj * 'b) -> unit) -> ('a, 'b) map -> unit
87 :     (* Apply a function to the entries of the map in map order. *)
88 :    
89 :     val map : ('b -> 'c) -> ('a, 'b) map -> ('a, 'c) map
90 :     val mapi : ('a obj * 'b -> 'c) -> ('a, 'b) map -> ('a, 'c) map
91 :     (* Create a new map by applying a map function to the
92 :     * name/value pairs in the map.
93 :     *)
94 :    
95 :     val foldl : ('b * 'c -> 'c) -> 'c -> ('a, 'b) map -> 'c
96 :     val foldli : ('a obj * 'b * 'c -> 'c) -> 'c -> ('a, 'b) map -> 'c
97 :     (* Apply a folding function to the entries of the map
98 :     * in increasing map order.
99 :     *)
100 :    
101 :     val foldr : ('b * 'c -> 'c) -> 'c -> ('a, 'b) map -> 'c
102 :     val foldri : ('a obj * 'b * 'c -> 'c) -> 'c -> ('a, 'b) map -> 'c
103 :     (* Apply a folding function to the entries of the map
104 :     * in decreasing map order.
105 :     *)
106 :    
107 :     val filter : ('b -> bool) -> ('a, 'b) map -> ('a, 'b) map
108 :     val filteri : ('a obj * 'b -> bool) -> ('a, 'b) map -> ('a, 'b) map
109 :     (* Filter out those elements of the map that do not satisfy the
110 :     * predicate. The filtering is done in increasing map order.
111 :     *)
112 :    
113 :     val mapPartial : ('b -> 'c option) -> ('a, 'b) map -> ('a, 'c) map
114 :     val mapPartiali : ('a obj * 'b -> 'c option) -> ('a, 'b) map -> ('a, 'c) map
115 :     (* map a partial function over the elements of a map in increasing
116 :     * map order.
117 :     *)
118 :    
119 :     end

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