summaryrefslogtreecommitdiff
path: root/21-28/21.hs
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2017-05-29 01:11:20 -0400
committerDeterminant <ted.sybil@gmail.com>2017-05-29 01:11:20 -0400
commitfa1bf6c2eac1c9f7969ff29504c9f51b9ba48008 (patch)
tree3ff5689d025100431adac277d0411ca88681166e /21-28/21.hs
parent9c608c32a9387a1dd1cb045e5822733ad181ccf8 (diff)
finish vol 3
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