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

6 lines
148 B
Haskell
Raw Normal View History

2024-05-24 18:50:16 -05:00
split :: [a] -> Int -> ([a], [a])
split x 0 = ([], x)
split (hd : tl) n = (hd : next_hd, next_tl)
where
(next_hd, next_tl) = split tl (n - 1)