summaryrefslogtreecommitdiff
path: root/h18.hs
diff options
context:
space:
mode:
Diffstat (limited to 'h18.hs')
-rw-r--r--h18.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/h18.hs b/h18.hs
new file mode 100644
index 0000000..b9e8192
--- /dev/null
+++ b/h18.hs
@@ -0,0 +1,7 @@
+slice :: [a] -> Int -> Int -> [a]
+slice (x:xs) a b
+ | a > 1 = slice xs (a-1) (b-1)
+ | a <= 1 && b >= 1 = x:(slice xs (a-1) (b-1))
+ | otherwise = []
+
+slice' xs i j = [x | (x,k)<- (zip xs [1..j]) , k >= i]