diff options
Diffstat (limited to '11-20/20.hs')
-rw-r--r-- | 11-20/20.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/11-20/20.hs b/11-20/20.hs new file mode 100644 index 0000000..c6a3ba8 --- /dev/null +++ b/11-20/20.hs @@ -0,0 +1,6 @@ +removeAt :: Int -> [a] -> (Maybe a, [a]) + +removeAt k (x:xs) + | k > 1 = let (a, b) = removeAt (k - 1) xs in (a, x:b) + | k == 1 = (Just x, xs) +removeAt _ l = (Nothing, l) |