summaryrefslogtreecommitdiff
path: root/11-20/18.hs
diff options
context:
space:
mode:
Diffstat (limited to '11-20/18.hs')
-rw-r--r--11-20/18.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/11-20/18.hs b/11-20/18.hs
new file mode 100644
index 0000000..e2ec1fb
--- /dev/null
+++ b/11-20/18.hs
@@ -0,0 +1,6 @@
+slice :: [a] -> Int -> Int -> [a]
+
+slice (x:xs) n m
+ | n > 1 = slice xs (n - 1) (m - 1)
+ | m > 0 = x:slice xs 0 (m - 1)
+slice _ _ _ = []