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

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

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

revision 815, Fri May 4 05:09:10 2001 UTC revision 816, Fri May 4 16:37:36 2001 UTC
# Line 72  Line 72 
72                | b => Array.update(arr, indx, b)                | b => Array.update(arr, indx, b)
73            end            end
74    
75      (* return true, if the key is in the domain of the table *)
76        fun inDomain (HT{hash_fn, eq_pred, table, ...}) key = let
77              val arr = !table
78              val hash = hash_fn key
79              val indx = index (hash, Array.length arr)
80              fun look HTRep.NIL = false
81                | look (HTRep.B(h, k, v, r)) =
82                    ((hash = h) andalso eq_pred(key, k)) orelse look r
83              in
84                look (Array.sub (arr, indx))
85              end
86    
87    (* find an item, the table's exception is raised if the item doesn't exist *)    (* find an item, the table's exception is raised if the item doesn't exist *)
88      fun lookup (HT{hash_fn, eq_pred, table, not_found, ...}) key = let      fun lookup (HT{hash_fn, eq_pred, table, not_found, ...}) key = let
89            val arr = !table            val arr = !table

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

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