summaryrefslogblamecommitdiff
path: root/11-20/18.hs
blob: e2ec1fbf71604d1a461b9d0c5817abf6302ce6ca (plain) (tree)
1
2
3
4
5
6





                                      
slice :: [a] -> Int -> Int -> [a]

slice (x:xs) n m
    | n > 1 = slice xs (n - 1) (m - 1)
    | m > 0 = x:slice xs 0 (m - 1)
slice _ _ _ = []