hunk ./src/Test/Data/List.hs 14
+takeWhileRev :: (Ord a) => (a -> Bool) -> [a] -> Bool
+takeWhileRev p xs =
+ ListHT.takeWhileRev p xs == reverse (takeWhile p (reverse xs))
+
+dropWhileRev :: (Ord a) => (a -> Bool) -> [a] -> Bool
+dropWhileRev p xs =
+ ListHT.dropWhileRev p xs == reverse (dropWhile p (reverse xs))
+
+
hunk ./src/Test/Data/List.hs 83
+ ("takeWhileRev", quickCheck (\a -> takeWhileRev ((a::Integer)>=))) :
+ ("dropWhileRev", quickCheck (\a -> dropWhileRev ((a::Integer)>=))) :
hunk ./src/Data/List/HT.hs 27
+ L.dropRev,
+ L.takeRev,
hunk ./src/Data/List/HT/Private.hs 442
+@takeRev n@ is like @reverse . take n . reverse@
+but it is lazy enough to work for infinite lists, too.
+-}
+takeRev :: Int -> [a] -> [a]
+takeRev n xs = Match.drop (drop n xs) xs
+
+{- |
+@dropRev n@ is like @reverse . drop n . reverse@
+but it is lazy enough to work for infinite lists, too.
+-}
+dropRev :: Int -> [a] -> [a]
+dropRev n xs = Match.take (drop n xs) xs
+
+
+{- |
hunk ./src/Data/List/Match.hs 5
+ L.takeRev,
+ L.dropRev,
hunk ./src/Data/List/Match/Private.hs 71
+takeRev :: [b] -> [a] -> [a]
+takeRev ys xs = drop (drop ys xs) xs
+
+dropRev :: [b] -> [a] -> [a]
+dropRev ys xs = take (drop ys xs) xs
+
hunk ./src/Test/Data/List.hs 23
+takeRev :: (Eq a) => Int -> [a] -> Bool
+takeRev n xs =
+ ListHT.takeRev n xs == reverse (take n (reverse xs))
+
+dropRev :: (Eq a) => Int -> [a] -> Bool
+dropRev n xs =
+ ListHT.dropRev n xs == reverse (drop n (reverse xs))
+
+
hunk ./src/Test/Data/List.hs 94
+ ("takeRev", simple takeRev) :
+ ("dropRev", simple dropRev) :
hunk ./src/Test/Data/ListMatch.hs 44
+takeRev :: (Eq a) => [b] -> [a] -> Bool
+takeRev xs ys =
+ Match.takeRev xs ys == reverse (Match.take xs (reverse ys))
+
+dropRev :: (Eq a) => [b] -> [a] -> Bool
+dropRev xs ys =
+ Match.dropRev xs ys == reverse (Match.drop xs (reverse ys))
+
+
hunk ./src/Test/Data/ListMatch.hs 74
+ ("takeRev", test2 takeRev) :
+ ("dropRev", test2 dropRev) :
hunk ./src/Test/Data/List.hs 83
+mapAdjacent :: (Num a, Eq a) => a -> [a] -> Bool
+mapAdjacent x xs =
+ ListHT.mapAdjacent subtract (scanl (+) x xs) == xs
+
hunk ./src/Test/Data/List.hs 107
+ ("mapAdjacent", quickCheck (mapAdjacent :: Integer -> [Integer] -> Bool)) :
hunk ./src/Data/List/HT.hs 56
+ L.mapAdjacent1,
hunk ./src/Data/List/HT/Private.hs 949
+{- |
+> mapAdjacent f a0 [(a1,b1), (a2,b2), (a3,b3)]
+> ==
+> [f a0 a1 b1, f a1 a2 b2, f a2 a3 b3]
+-}
+mapAdjacent1 :: (a -> a -> b -> c) -> a -> [(a,b)] -> [c]
+mapAdjacent1 f a xs =
+ zipWith (\a0 (a1,b) -> f a0 a1 b) (a : map fst xs) xs
+