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/branches/FLINT/src/comp-lib/intmapf.sml
ViewVC logotype

Diff of /sml/branches/FLINT/src/comp-lib/intmapf.sml

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

revision 113, Fri Jun 5 19:41:21 1998 UTC revision 207, Fri Jan 15 15:54:19 1999 UTC
# Line 17  Line 17 
17    val cardinality : 'a intmap -> int    val cardinality : 'a intmap -> int
18    val difference : 'a intmap * 'b intmap -> 'a intmap    val difference : 'a intmap * 'b intmap -> 'a intmap
19    val delete : int * 'a intmap -> 'a intmap    val delete : int * 'a intmap -> 'a intmap
20      val fold : (int * 'a * 'b -> 'b) -> 'b -> 'a intmap -> 'b
21  end  end
22    
23  (*  (*
# Line 164  Line 165 
165                  else if weight*n2 < n1 then T'(v1,v1',l1,concat(r1,t2))                  else if weight*n2 < n1 then T'(v1,v1',l1,concat(r1,t2))
166                       else cat2(t1,t2)                       else cat2(t1,t2)
167    
             fun fold(f,base,set) =  
                 let fun fold'(base,E) = base  
                       | fold'(base,T(v,v',_,l,r)) = fold'(f((v,v'),fold'(base,r)),l)  
                 in  
                     fold'(base,set)  
                 end  
   
168          in          in
169    
170              type  'a intmap = 'a Map              type  'a intmap = 'a Map
# Line 207  Line 201 
201                          if x<v then mem l else if x>v then mem r else v'                          if x<v then mem l else if x>v then mem r else v'
202                  in mem set end                  in mem set end
203    
204              fun members set = fold(op::,[],set)              fun fold f base map =
205                    let fun fold' (base,E) = base
206                          | fold' (base,T(v,v',_,l,r)) =
207                            fold'(fold'(f(v, v', base), l), r)
208                    in
209                        fold'(base, map)
210                    end
211    
212                fun members m = fold (fn (i,v,res) => (i,v)::res) [] m
213    
214              fun cardinality E = 0              fun cardinality E = 0
215                | cardinality (T(_,_,n,_,_)) = n                | cardinality (T(_,_,n,_,_)) = n

Legend:
Removed from v.113  
changed lines
  Added in v.207

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