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 /smlnj-lib/branches/rt-transition/Util/splay-set-fn.sml
 [smlnj] / smlnj-lib / branches / rt-transition / Util / splay-set-fn.sml

# Diff of /smlnj-lib/branches/rt-transition/Util/splay-set-fn.sml

revision 4069, Tue Jun 9 20:52:48 2015 UTC revision 4070, Thu Jun 11 12:33:25 2015 UTC
# Line 323  Line 323
323      fun exists p EMPTY = false      fun exists p EMPTY = false
324        | exists p (SET{root,...}) = let        | exists p (SET{root,...}) = let
325            fun ex SplayNil = false            fun ex SplayNil = false
326              | ex (SplayObj{value=v,left=l,right=r}) =              | ex (SplayObj{value=v,left=l,right=r}) = ex l orelse p v orelse ex r
if p v then true
else case ex l of
false => ex r
| _ => true
327            in            in
328              ex (!root)              ex (!root)
329            end            end
330
331        fun all p EMPTY = false
332          | all p (SET{root,...}) = let
333              fun all' SplayNil = false
334                | all' (SplayObj{value=v,left=l,right=r}) = all' l andalso p v andalso all' r
335              in
336                all' (!root)
337              end
338
339      fun find p EMPTY = NONE      fun find p EMPTY = NONE
340        | find p (SET{root,...}) = let        | find p (SET{root,...}) = let
341            fun ex SplayNil = NONE            fun ex SplayNil = NONE
# Line 344  Line 348
348              ex (!root)              ex (!root)
349            end            end
350

351    end (* SplaySet *)    end (* SplaySet *)

Legend:
 Removed from v.4069 changed lines Added in v.4070