[MLton-commit] r5360

Vesa Karvonen vesak at mlton.org
Wed Feb 28 04:32:52 PST 2007


Fixed a bug.  Something tells me there must be a better implementation
technique...

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml	2007-02-28 09:55:47 UTC (rev 5359)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml	2007-02-28 12:32:36 UTC (rev 5360)
@@ -49,8 +49,11 @@
           NONE => NONE
         | SOME (a, n) => (front := n ; SOME a)
 
-   fun filter p (IN {back, front}) =
-       back := Node.filter p (!front)
+   fun filter p (q as IN {back, front}) =
+       case N.get (!front) of
+          NONE => ()
+        | SOME (v, n) => if p v then back := Node.filter p n
+                         else (front := n ; filter p q)
 
    fun filterOut p =
        filter (negate p)




More information about the MLton-commit mailing list