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