summaryrefslogtreecommitdiff
path: root/lec07
diff options
context:
space:
mode:
Diffstat (limited to 'lec07')
-rw-r--r--lec07/JoinList.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/lec07/JoinList.hs b/lec07/JoinList.hs
index 7ec30a9..61df8da 100644
--- a/lec07/JoinList.hs
+++ b/lec07/JoinList.hs
@@ -28,3 +28,14 @@ indexJ n (Append m jl1 jl2)
| n >= tag1 = indexJ (n - tag1) jl2
where tag1 = tag jl1
+dropJ :: (Sized b, Monoid b) => Int -> JoinList b a -> JoinList b a
+dropJ _ Empty = Empty
+dropJ n jl
+ | n <= 0 = jl
+dropJ n (Single _ _)
+ | n >= 1 = Empty
+dropJ n (Append m jl1 jl2)
+ | n >= m = Empty
+ | n >= tag1 = jl2
+ where tag1 = tag jl1
+