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/mono-hash-table-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/trunk/Util/mono-hash-table-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2144 - (view) (download)

1 : monnier 2 (* mono-hash-table-sig.sml
2 :     *
3 :     * COPYRIGHT (c) 1992 by AT&T Bell Laboratories.
4 :     *
5 :     * The result signature of the hash table functor (see hash-table.sml).
6 :     *
7 :     * AUTHOR: John Reppy
8 :     * AT&T Bell Laboratories
9 :     * Murray Hill, NJ 07974
10 :     * jhr@research.att.com
11 :     *)
12 :    
13 :     signature MONO_HASH_TABLE =
14 :     sig
15 :    
16 :     structure Key : HASH_KEY
17 :    
18 :     type 'a hash_table
19 :    
20 :     val mkTable : (int * exn) -> 'a hash_table
21 :     (* Create a new table; the int is a size hint and the exception
22 :     * is to be raised by find.
23 :     *)
24 :    
25 : monnier 8 val clear : 'a hash_table -> unit
26 :     (* remove all elements from the table *)
27 :    
28 : monnier 2 val insert : 'a hash_table -> (Key.hash_key * 'a) -> unit
29 :     (* Insert an item. If the key already has an item associated with it,
30 :     * then the old item is discarded.
31 :     *)
32 :    
33 : jhr 816 val inDomain : 'a hash_table -> Key.hash_key -> bool
34 :     (* return true, if the key is in the domain of the table *)
35 :    
36 : monnier 2 val lookup : 'a hash_table -> Key.hash_key -> 'a
37 :     (* Find an item, the table's exception is raised if the item doesn't exist *)
38 :    
39 :     val find : 'a hash_table -> Key.hash_key -> 'a option
40 :     (* Look for an item, return NONE if the item doesn't exist *)
41 :    
42 :     val remove : 'a hash_table -> Key.hash_key -> 'a
43 :     (* Remove an item, returning the item. The table's exception is raised if
44 :     * the item doesn't exist.
45 :     *)
46 :    
47 :     val numItems : 'a hash_table -> int
48 :     (* Return the number of items in the table *)
49 :    
50 :     val listItems : 'a hash_table -> 'a list
51 :     val listItemsi : 'a hash_table -> (Key.hash_key * 'a) list
52 :     (* Return a list of the items (and their keys) in the table *)
53 :    
54 :     val app : ('a -> unit) -> 'a hash_table -> unit
55 :     val appi : ((Key.hash_key * 'a) -> unit) -> 'a hash_table -> unit
56 :     (* Apply a function to the entries of the table *)
57 :    
58 :     val map : ('a -> 'b) -> 'a hash_table -> 'b hash_table
59 :     val mapi : ((Key.hash_key * 'a) -> 'b) -> 'a hash_table -> 'b hash_table
60 :     (* Map a table to a new table that has the same keys *)
61 :    
62 :     val fold : (('a * 'b) -> 'b) -> 'b -> 'a hash_table -> 'b
63 :     val foldi : ((Key.hash_key * 'a * 'b) -> 'b) -> 'b -> 'a hash_table -> 'b
64 :    
65 : jhr 596 val modify : ('a -> 'a) -> 'a hash_table -> unit
66 :     val modifyi : ((Key.hash_key * 'a) -> 'a) -> 'a hash_table -> unit
67 :     (* modify the hash-table items in place *)
68 :    
69 : monnier 2 (** Also mapPartial?? *)
70 :     val filter : ('a -> bool) -> 'a hash_table -> unit
71 :     val filteri : ((Key.hash_key * 'a) -> bool) -> 'a hash_table -> unit
72 :     (* remove any hash table items that do not satisfy the given
73 :     * predicate.
74 :     *)
75 :    
76 :     val copy : 'a hash_table -> 'a hash_table
77 :     (* Create a copy of a hash table *)
78 :    
79 :     val bucketSizes : 'a hash_table -> int list
80 :     (* returns a list of the sizes of the various buckets. This is to
81 :     * allow users to gauge the quality of their hashing function.
82 :     *)
83 :    
84 :     end (* MONO_HASH_TABLE *)

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