From: Ramakrishnan Muthukrishnan Date: Thu, 25 Dec 2014 01:56:06 +0000 (+0530) Subject: dropJ: handle the negative n case X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/frontends/FOOURL?a=commitdiff_plain;h=07e4c4eedd8babb4e7ae89e5a901282342b11d0a;p=yorgey.git dropJ: handle the negative n case --- 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