From 07e4c4eedd8babb4e7ae89e5a901282342b11d0a Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org> Date: Thu, 25 Dec 2014 07:26:06 +0530 Subject: [PATCH] dropJ: handle the negative n case --- hw7/JoinList.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/hw7/JoinList.hs b/hw7/JoinList.hs index b7a4aeb..7f13837 100644 --- a/hw7/JoinList.hs +++ b/hw7/JoinList.hs @@ -33,6 +33,7 @@ indexJ n (Append _ l r) | n < (getSize (size (tag l))) = indexJ n l -- 2. drop dropJ :: (Sized b, Monoid b) => Int -> JoinList b a -> JoinList b a +dropJ n x | n < 0 = x dropJ 0 x = x dropJ _ Empty = Empty dropJ _ (Single _ _) = Empty -- 2.45.2