aboutsummaryrefslogtreecommitdiffstats
path: root/utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'utils.hs')
-rw-r--r--utils.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils.hs b/utils.hs
index 04211ea..0ba4bcb 100644
--- a/utils.hs
+++ b/utils.hs
@@ -18,8 +18,11 @@ splitOn p s = case dropWhile p s of
transpose :: [[a]] -> [[a]]
transpose = getZipList . traverse ZipList
-mapWithIndex :: (Num a1, Enum a1) => (a2 -> b) -> [a2] -> [(a1, b)]
+mapWithIndex :: (a -> b) -> [a] -> [(Int, b)]
mapWithIndex f xs = zip [0 ..] (map f xs)
removeAt :: [Int] -> [b] -> [b]
removeAt is xs = mapWithIndex id xs $> filter (\(i', _) -> i' `notElem` is) .> map snd
+
+slice :: Int -> Int -> [a] -> [a]
+slice from to xs = take (to - from + 1) (drop from xs) \ No newline at end of file