projects
/
yorgey.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
047b4b4
)
dropJ: handle the negative n case
author
Ramakrishnan Muthukrishnan
<ram@rkrishnan.org>
Thu, 25 Dec 2014 01:56:06 +0000
(07:26 +0530)
committer
Ramakrishnan Muthukrishnan
<ram@rkrishnan.org>
Thu, 25 Dec 2014 01:56:06 +0000
(07:26 +0530)
hw7/JoinList.hs
patch
|
blob
|
history
diff --git
a/hw7/JoinList.hs
b/hw7/JoinList.hs
index b7a4aeb949599db702dfd0696d9e4cd2a4261581..7f13837e02d6bb79962d1fc654a6df9da70b5f4f 100644
(file)
--- 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