aboutsummaryrefslogtreecommitdiff
path: root/src/Utils/List.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils/List.elm')
-rw-r--r--src/Utils/List.elm17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Utils/List.elm b/src/Utils/List.elm
new file mode 100644
index 0000000..6895d83
--- /dev/null
+++ b/src/Utils/List.elm
@@ -0,0 +1,17 @@
+module Utils.List
+ ( repeat
+ , splitAt
+ ) where
+
+import List
+
+repeat : Int -> a -> List a
+repeat count elem =
+ if count > 0
+ then
+ elem :: (repeat (count - 1) elem)
+ else
+ []
+
+splitAt : Int -> List a -> (List a, List a)
+splitAt n xs = (List.take n xs, List.drop n xs)