99-haskell-problems/Problems 11-20/problem_20.hs

5 lines
130 B
Haskell

removeAt :: Int -> [a] -> (a, [a])
removeAt n ls = (last l, take m l ++ r)
where
(l, r) = splitAt n ls
m = length l - 1