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 3 - (view) (download)
Original Path: sml/branches/SMLNJ/src/smlnj-lib/Util/mono-hash-table-sig.sml

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 :     val insert : 'a hash_table -> (Key.hash_key * 'a) -> unit
26 :     (* Insert an item. If the key already has an item associated with it,
27 :     * then the old item is discarded.
28 :     *)
29 :    
30 :     val lookup : 'a hash_table -> Key.hash_key -> 'a
31 :     (* Find an item, the table's exception is raised if the item doesn't exist *)
32 :    
33 :     val find : 'a hash_table -> Key.hash_key -> 'a option
34 :     (* Look for an item, return NONE if the item doesn't exist *)
35 :    
36 :     val remove : 'a hash_table -> Key.hash_key -> 'a
37 :     (* Remove an item, returning the item. The table's exception is raised if
38 :     * the item doesn't exist.
39 :     *)
40 :    
41 :     val numItems : 'a hash_table -> int
42 :     (* Return the number of items in the table *)
43 :    
44 :     val listItems : 'a hash_table -> 'a list
45 :     val listItemsi : 'a hash_table -> (Key.hash_key * 'a) list
46 :     (* Return a list of the items (and their keys) in the table *)
47 :    
48 :     val app : ('a -> unit) -> 'a hash_table -> unit
49 :     val appi : ((Key.hash_key * 'a) -> unit) -> 'a hash_table -> unit
50 :     (* Apply a function to the entries of the table *)
51 :    
52 :     val map : ('a -> 'b) -> 'a hash_table -> 'b hash_table
53 :     val mapi : ((Key.hash_key * 'a) -> 'b) -> 'a hash_table -> 'b hash_table
54 :     (* Map a table to a new table that has the same keys *)
55 :    
56 :     val fold : (('a * 'b) -> 'b) -> 'b -> 'a hash_table -> 'b
57 :     val foldi : ((Key.hash_key * 'a * 'b) -> 'b) -> 'b -> 'a hash_table -> 'b
58 :    
59 :     (** Also mapPartial?? *)
60 :     val filter : ('a -> bool) -> 'a hash_table -> unit
61 :     val filteri : ((Key.hash_key * 'a) -> bool) -> 'a hash_table -> unit
62 :     (* remove any hash table items that do not satisfy the given
63 :     * predicate.
64 :     *)
65 :    
66 :     val copy : 'a hash_table -> 'a hash_table
67 :     (* Create a copy of a hash table *)
68 :    
69 :     val bucketSizes : 'a hash_table -> int list
70 :     (* returns a list of the sizes of the various buckets. This is to
71 :     * allow users to gauge the quality of their hashing function.
72 :     *)
73 :    
74 :     end (* MONO_HASH_TABLE *)

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