summaryrefslogtreecommitdiff
path: root/21-28/21.hs
diff options
context:
space:
mode:
Diffstat (limited to '21-28/21.hs')
-rw-r--r--21-28/21.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/21-28/21.hs b/21-28/21.hs
new file mode 100644
index 0000000..4cbeb49
--- /dev/null
+++ b/21-28/21.hs
@@ -0,0 +1,5 @@
+insertAt :: a -> [a] -> Int -> [a]
+
+insertAt e (x:xs) n | n > 1 = x:insertAt e xs (n - 1)
+insertAt e l 1 = e:l
+insertAt _ l _ = l