summaryrefslogtreecommitdiff
path: root/11-20/17.hs
blob: e058b27156d1622808ede67e5e3ccc222532ee34 (plain) (blame)
1
2
3
4
5
6
split :: [a] -> Int -> ([a], [a])

split [] _ = ([], [])
split l@(x:xs) n
  | n > 0 = let (ys, zs) = split xs (n - 1) in (x:ys, zs)
  | otherwise = ([], l)