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 /sml/trunk/src/smlnj-lib/Util/hash2-table-fn.sml
ViewVC logotype

Diff of /sml/trunk/src/smlnj-lib/Util/hash2-table-fn.sml

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

revision 651, Thu Jun 1 18:34:03 2000 UTC revision 816, Fri May 4 16:37:36 2001 UTC
# Line 139  Line 139 
139              (* end case *)              (* end case *)
140            end            end
141    
142      (* return true, if the key is in the domain of the table *)
143        fun inDomain (hashVal, sameKey) tbl key = let
144              val arr = !tbl
145              val hash = hashVal key
146              val indx = index (hash, Array.length arr)
147              fun look HTRep.NIL = false
148                | look (HTRep.B(h, k, v, r)) =
149                    ((hash = h) andalso sameKey(key, k)) orelse look r
150              in
151                look (Array.sub (arr, indx))
152              end
153        fun inDomain1 (TBL{tbl1, ...}) = inDomain (Key1.hashVal, Key1.sameKey) tbl1
154        fun inDomain2 (TBL{tbl2, ...}) = inDomain (Key2.hashVal, Key2.sameKey) tbl2
155    
156    (* Look for an item, the table's exception is raised if the item doesn't exist *)    (* Look for an item, the table's exception is raised if the item doesn't exist *)
157      fun lookup (hashVal, sameKey) (tbl, not_found) key = let      fun lookup (hashVal, sameKey) (tbl, not_found) key = let
158            val arr = !tbl            val arr = !tbl

Legend:
Removed from v.651  
changed lines
  Added in v.816

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