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/redblack-set-fn.sml
ViewVC logotype

Diff of /sml/trunk/src/smlnj-lib/Util/redblack-set-fn.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 358  Line 358 
358              SET(n, linkAll result)              SET(n, linkAll result)
359            end            end
360    
361        fun partition pred (SET(_, t)) = let
362              fun walk (E, n1, result1, n2, result2) = (n1, result1, n2, result2)
363                | walk (T(_, a, x, b), n1, result1, n2, result2) = let
364                    val (n1, result1, n2, result2) = walk(a, n1, result1, n2, result2)
365                    in
366                      if (pred x)
367                        then walk(b, n1+1, addItem(x, result1), n2, result2)
368                        else walk(b, n1, result1, n2+1, addItem(x, result2))
369                    end
370              val (n1, result1, n2, result2) = walk (t, 0, ZERO, 0, ZERO)
371              in
372                (SET(n1, linkAll result1), SET(n2, linkAll result2))
373              end
374    
375      fun exists pred = let      fun exists pred = let
376            fun test E = false            fun test E = false
377              | test (T(_, a, x, b)) = test a orelse pred x orelse test b              | test (T(_, a, x, b)) = test a orelse pred x orelse test b

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