From 5b6b71373c3670ebe1aef1dad7d699a3e9f6998b Mon Sep 17 00:00:00 2001 From: rand00 Date: Sun, 4 Feb 2018 17:30:29 +0100 Subject: [PATCH 1/3] CCRAL: Fixed bug in drop_tree_. --- src/data/CCRAL.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/CCRAL.ml b/src/data/CCRAL.ml index f025bf53..a8e7422d 100644 --- a/src/data/CCRAL.ml +++ b/src/data/CCRAL.ml @@ -337,7 +337,7 @@ and drop_tree_ ~size n t tail = match t with | Node (_,l,r) -> if n=1 then append_tree_ l (append_tree_ r tail) else - let size' = size/2 in + let size' = if size mod 2 <> 0 then (size/2)+1 else size/2 in if n-1 < size' then drop_tree_ ~size:size' (n-1) l (append_tree_ r tail) else drop_tree_ ~size:size' (n-1-size') r tail From cfb8e55ebab5970a30bb1a99a3b8c2c599099c88 Mon Sep 17 00:00:00 2001 From: rand00 Date: Sun, 4 Feb 2018 18:54:56 +0100 Subject: [PATCH 2/3] CCRAL: drop: Added test for bugfix. --- src/data/CCRAL.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/data/CCRAL.ml b/src/data/CCRAL.ml index a8e7422d..351e687b 100644 --- a/src/data/CCRAL.ml +++ b/src/data/CCRAL.ml @@ -342,6 +342,10 @@ and drop_tree_ ~size n t tail = match t with then drop_tree_ ~size:size' (n-1) l (append_tree_ r tail) else drop_tree_ ~size:size' (n-1-size') r tail +(*$T + of_list [1;2;3] |> drop 2 |> length = 1 +*) + let drop_while ~f l = let rec aux p st = match st with | St_nil -> Nil From 47c5c41a968a82fb0503de2cdaa19b1fe64877dd Mon Sep 17 00:00:00 2001 From: rand00 Date: Sun, 4 Feb 2018 18:55:37 +0100 Subject: [PATCH 3/3] Added Rand to authors --- AUTHORS.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.adoc b/AUTHORS.adoc index 5d6d131c..0d996399 100644 --- a/AUTHORS.adoc +++ b/AUTHORS.adoc @@ -25,3 +25,4 @@ - Fabian Hemmer (copy) - Maciej Woś (@lostman) - Orbifx (Stavros Polymenis) +- Rand (@rand00) \ No newline at end of file