Commits

Anonymous committed 5e5b54e

Fix major bug in [fold] that caused a BUS ERROR (ack!), and also fixed
[filter] so that it uses the non-recursive [fold] function here instead of
going to the extra work of using [Cf_seq.fold].

  • Participants
  • Parent commits 1790030

Comments (0)

Files changed (1)

File cf/cf_deque.ml

     | X (a,b) -> f (f v a) b
     | U (a,b,c) ->
         let v = fold f v a in
-        let v = (Obj.magic fold) (fun (x,y) -> f (f v x) y) b in
+        let g v (x, y) = f (f v x) y in
+        let v = (Obj.magic fold) g v b in
         fold f v c
     | V (a,b,c) ->
         let v = fold f v a in
-        let v = (Obj.magic fold) (fold f v) (Lazy.force b) in
+        let v = (Obj.magic fold) (fold f) v (Lazy.force b) in
         fold f v c
 
 let filter f =
     let g d' x = if f x then B.push x d' else d' in
-    fun d -> Cf_seq.fold g Z (A.to_seq d)
+    fold g Z
 
 let rec map f = function
     | Z ->