| 1 | 1 patch for repository http://code.haskell.org/vector: |
|---|
| 2 | |
|---|
| 3 | Tue Jan 4 17:43:12 MSK 2011 Khudyakov Alexey <alexey.skladnoy@gmail.com> |
|---|
| 4 | * Add iterate function |
|---|
| 5 | |
|---|
| 6 | New patches: |
|---|
| 7 | |
|---|
| 8 | [Add iterate function |
|---|
| 9 | Khudyakov Alexey <alexey.skladnoy@gmail.com>**20110104144312 |
|---|
| 10 | Ignore-this: 74cc3c91b966401f63a5814038a6527f |
|---|
| 11 | ] { |
|---|
| 12 | hunk ./Data/Vector.hs 49 |
|---|
| 13 | -- * Construction |
|---|
| 14 | |
|---|
| 15 | -- ** Initialisation |
|---|
| 16 | - empty, singleton, replicate, generate, |
|---|
| 17 | + empty, singleton, replicate, generate, iterate, |
|---|
| 18 | |
|---|
| 19 | -- ** Monadic initialisation |
|---|
| 20 | replicateM, create, |
|---|
| 21 | hunk ./Data/Vector.hs 164 |
|---|
| 22 | filter, takeWhile, dropWhile, span, break, |
|---|
| 23 | elem, notElem, |
|---|
| 24 | foldl, foldl1, foldr, foldr1, |
|---|
| 25 | - all, any, and, or, sum, product, minimum, maximum, |
|---|
| 26 | + all, any, and, or, sum, product, minimum, maximum, iterate, |
|---|
| 27 | scanl, scanl1, scanr, scanr1, |
|---|
| 28 | enumFromTo, enumFromThenTo, |
|---|
| 29 | mapM, mapM_ ) |
|---|
| 30 | hunk ./Data/Vector.hs 447 |
|---|
| 31 | {-# INLINE generate #-} |
|---|
| 32 | generate = G.generate |
|---|
| 33 | |
|---|
| 34 | +-- | /O(n)/ Apply function n times to value. Zeroth element is original value. |
|---|
| 35 | +iterate :: Int -> (a -> a) -> a -> Vector a |
|---|
| 36 | +{-# INLINE iterate #-} |
|---|
| 37 | +iterate = G.iterate |
|---|
| 38 | + |
|---|
| 39 | -- Unfolding |
|---|
| 40 | -- --------- |
|---|
| 41 | |
|---|
| 42 | hunk ./Data/Vector/Fusion/Stream.hs 58 |
|---|
| 43 | and, or, |
|---|
| 44 | |
|---|
| 45 | -- * Unfolding |
|---|
| 46 | - unfoldr, unfoldrN, |
|---|
| 47 | + unfoldr, unfoldrN, iterate, |
|---|
| 48 | |
|---|
| 49 | -- * Scans |
|---|
| 50 | prescanl, prescanl', |
|---|
| 51 | hunk ./Data/Vector/Fusion/Stream.hs 93 |
|---|
| 52 | elem, notElem, |
|---|
| 53 | foldl, foldl1, foldr, foldr1, |
|---|
| 54 | and, or, |
|---|
| 55 | + iterate, |
|---|
| 56 | scanl, scanl1, |
|---|
| 57 | enumFromTo, enumFromThenTo, |
|---|
| 58 | mapM, mapM_ ) |
|---|
| 59 | hunk ./Data/Vector/Fusion/Stream.hs 422 |
|---|
| 60 | {-# INLINE unfoldrN #-} |
|---|
| 61 | unfoldrN = M.unfoldrN |
|---|
| 62 | |
|---|
| 63 | +-- | Apply function n-1 times to value. Zeroth element is original value. |
|---|
| 64 | +iterate :: Int -> (a -> a) -> a -> Stream a |
|---|
| 65 | +{-# INLINE iterate #-} |
|---|
| 66 | +iterate = M.iterate |
|---|
| 67 | + |
|---|
| 68 | -- Scans |
|---|
| 69 | -- ----- |
|---|
| 70 | |
|---|
| 71 | hunk ./Data/Vector/Fusion/Stream/Monadic.hs 59 |
|---|
| 72 | -- * Unfolding |
|---|
| 73 | unfoldr, unfoldrM, |
|---|
| 74 | unfoldrN, unfoldrNM, |
|---|
| 75 | + iterate, iterateM, |
|---|
| 76 | |
|---|
| 77 | -- * Scans |
|---|
| 78 | prescanl, prescanlM, prescanl', prescanlM', |
|---|
| 79 | hunk ./Data/Vector/Fusion/Stream/Monadic.hs 90 |
|---|
| 80 | elem, notElem, |
|---|
| 81 | foldl, foldl1, foldr, foldr1, |
|---|
| 82 | and, or, |
|---|
| 83 | + iterate, |
|---|
| 84 | scanl, scanl1, |
|---|
| 85 | enumFromTo, enumFromThenTo ) |
|---|
| 86 | |
|---|
| 87 | hunk ./Data/Vector/Fusion/Stream/Monadic.hs 998 |
|---|
| 88 | Nothing -> Done |
|---|
| 89 | ) (f s) |
|---|
| 90 | |
|---|
| 91 | +-- | Apply monadic function n times to value. Zeroth element is original value. |
|---|
| 92 | +iterateM :: Monad m => Int -> (a -> m a) -> a -> Stream m a |
|---|
| 93 | +{-# INLINE_STREAM iterateM #-} |
|---|
| 94 | +iterateM n f x0 = Stream step (x0,n) (Exact (delay_inline max n 0)) |
|---|
| 95 | + where |
|---|
| 96 | + {-# INLINE_INNER step #-} |
|---|
| 97 | + step (x,i) | i <= 0 = return Done |
|---|
| 98 | + | i == n = return $ Yield x (x,i-1) |
|---|
| 99 | + | otherwise = do a <- f x |
|---|
| 100 | + return $ Yield a (a,i-1) |
|---|
| 101 | + |
|---|
| 102 | +-- | Apply function n times to value. Zeroth element is original value. |
|---|
| 103 | +iterate :: Monad m => Int -> (a -> a) -> a -> Stream m a |
|---|
| 104 | +{-# INLINE_STREAM iterate #-} |
|---|
| 105 | +iterate n f x0 = iterateM n (return . f) x0 |
|---|
| 106 | + |
|---|
| 107 | -- Scans |
|---|
| 108 | -- ----- |
|---|
| 109 | |
|---|
| 110 | hunk ./Data/Vector/Generic.hs 39 |
|---|
| 111 | -- * Construction |
|---|
| 112 | |
|---|
| 113 | -- ** Initialisation |
|---|
| 114 | - empty, singleton, replicate, generate, |
|---|
| 115 | + empty, singleton, replicate, generate, iterate, |
|---|
| 116 | |
|---|
| 117 | -- ** Monadic initialisation |
|---|
| 118 | replicateM, create, |
|---|
| 119 | hunk ./Data/Vector/Generic.hs 179 |
|---|
| 120 | filter, takeWhile, dropWhile, span, break, |
|---|
| 121 | elem, notElem, |
|---|
| 122 | foldl, foldl1, foldr, foldr1, |
|---|
| 123 | - all, any, and, or, sum, product, maximum, minimum, |
|---|
| 124 | + all, any, and, or, sum, product, maximum, minimum, iterate, |
|---|
| 125 | scanl, scanl1, scanr, scanr1, |
|---|
| 126 | enumFromTo, enumFromThenTo, |
|---|
| 127 | mapM, mapM_ ) |
|---|
| 128 | hunk ./Data/Vector/Generic.hs 489 |
|---|
| 129 | {-# INLINE generate #-} |
|---|
| 130 | generate n f = unstream (Stream.generate n f) |
|---|
| 131 | |
|---|
| 132 | +-- | /O(n)/ Apply function n times to value. Zeroth element is original value. |
|---|
| 133 | +iterate :: Vector v a => Int -> (a -> a) -> a -> v a |
|---|
| 134 | +{-# INLINE iterate #-} |
|---|
| 135 | +iterate n f x = unstream (Stream.iterate n f x) |
|---|
| 136 | + |
|---|
| 137 | -- Unfolding |
|---|
| 138 | -- --------- |
|---|
| 139 | |
|---|
| 140 | hunk ./Data/Vector/Primitive.hs 42 |
|---|
| 141 | -- * Construction |
|---|
| 142 | |
|---|
| 143 | -- ** Initialisation |
|---|
| 144 | - empty, singleton, replicate, generate, |
|---|
| 145 | + empty, singleton, replicate, generate, iterate, |
|---|
| 146 | |
|---|
| 147 | -- ** Monadic initialisation |
|---|
| 148 | replicateM, create, |
|---|
| 149 | hunk ./Data/Vector/Primitive.hs 154 |
|---|
| 150 | filter, takeWhile, dropWhile, span, break, |
|---|
| 151 | elem, notElem, |
|---|
| 152 | foldl, foldl1, foldr, foldr1, |
|---|
| 153 | - all, any, sum, product, minimum, maximum, |
|---|
| 154 | + all, any, sum, product, minimum, maximum, iterate, |
|---|
| 155 | scanl, scanl1, scanr, scanr1, |
|---|
| 156 | enumFromTo, enumFromThenTo, |
|---|
| 157 | mapM, mapM_ ) |
|---|
| 158 | hunk ./Data/Vector/Primitive.hs 448 |
|---|
| 159 | {-# INLINE generate #-} |
|---|
| 160 | generate = G.generate |
|---|
| 161 | |
|---|
| 162 | +-- | /O(n)/ Apply function n times to value. Zeroth element is original value. |
|---|
| 163 | +iterate :: Prim a => Int -> (a -> a) -> a -> Vector a |
|---|
| 164 | +{-# INLINE iterate #-} |
|---|
| 165 | +iterate = G.iterate |
|---|
| 166 | + |
|---|
| 167 | -- Unfolding |
|---|
| 168 | -- --------- |
|---|
| 169 | |
|---|
| 170 | hunk ./Data/Vector/Storable.hs 39 |
|---|
| 171 | -- * Construction |
|---|
| 172 | |
|---|
| 173 | -- ** Initialisation |
|---|
| 174 | - empty, singleton, replicate, generate, |
|---|
| 175 | + empty, singleton, replicate, generate, iterate, |
|---|
| 176 | |
|---|
| 177 | -- ** Monadic initialisation |
|---|
| 178 | replicateM, create, |
|---|
| 179 | hunk ./Data/Vector/Storable.hs 157 |
|---|
| 180 | filter, takeWhile, dropWhile, span, break, |
|---|
| 181 | elem, notElem, |
|---|
| 182 | foldl, foldl1, foldr, foldr1, |
|---|
| 183 | - all, any, and, or, sum, product, minimum, maximum, |
|---|
| 184 | + all, any, and, or, sum, product, minimum, maximum, iterate, |
|---|
| 185 | scanl, scanl1, scanr, scanr1, |
|---|
| 186 | enumFromTo, enumFromThenTo, |
|---|
| 187 | mapM, mapM_ ) |
|---|
| 188 | hunk ./Data/Vector/Storable.hs 457 |
|---|
| 189 | {-# INLINE generate #-} |
|---|
| 190 | generate = G.generate |
|---|
| 191 | |
|---|
| 192 | +-- | /O(n)/ Apply function n times to value. Zeroth element is original value. |
|---|
| 193 | +iterate :: Storable a => Int -> (a -> a) -> a -> Vector a |
|---|
| 194 | +{-# INLINE iterate #-} |
|---|
| 195 | +iterate = G.iterate |
|---|
| 196 | + |
|---|
| 197 | -- Unfolding |
|---|
| 198 | -- --------- |
|---|
| 199 | |
|---|
| 200 | hunk ./Data/Vector/Unboxed.hs 62 |
|---|
| 201 | -- * Construction |
|---|
| 202 | |
|---|
| 203 | -- ** Initialisation |
|---|
| 204 | - empty, singleton, replicate, generate, |
|---|
| 205 | + empty, singleton, replicate, generate, iterate, |
|---|
| 206 | |
|---|
| 207 | -- ** Monadic initialisation |
|---|
| 208 | replicateM, create, |
|---|
| 209 | hunk ./Data/Vector/Unboxed.hs 175 |
|---|
| 210 | filter, takeWhile, dropWhile, span, break, |
|---|
| 211 | elem, notElem, |
|---|
| 212 | foldl, foldl1, foldr, foldr1, |
|---|
| 213 | - all, any, and, or, sum, product, minimum, maximum, |
|---|
| 214 | + all, any, and, or, sum, product, minimum, maximum, iterate, |
|---|
| 215 | scanl, scanl1, scanr, scanr1, |
|---|
| 216 | enumFromTo, enumFromThenTo, |
|---|
| 217 | mapM, mapM_ ) |
|---|
| 218 | hunk ./Data/Vector/Unboxed.hs 423 |
|---|
| 219 | {-# INLINE generate #-} |
|---|
| 220 | generate = G.generate |
|---|
| 221 | |
|---|
| 222 | +-- | /O(n)/ Apply function n times to value. Zeroth element is original value. |
|---|
| 223 | +iterate :: Unbox a => Int -> (a -> a) -> a -> Vector a |
|---|
| 224 | +{-# INLINE iterate #-} |
|---|
| 225 | +iterate = G.iterate |
|---|
| 226 | + |
|---|
| 227 | -- Unfolding |
|---|
| 228 | -- --------- |
|---|
| 229 | |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | Context: |
|---|
| 233 | |
|---|
| 234 | [TAG 0.7.0.1 |
|---|
| 235 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101104225111 |
|---|
| 236 | Ignore-this: e619f4e63ff96ca2b7c7753fdd53a4b |
|---|
| 237 | ] |
|---|
| 238 | [Bump versions and modify flags in benchmarks |
|---|
| 239 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101104223856 |
|---|
| 240 | Ignore-this: 23c742cd11bb4102b7da27f3fe714c41 |
|---|
| 241 | ] |
|---|
| 242 | [Don't use package ghc |
|---|
| 243 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101104223805 |
|---|
| 244 | Ignore-this: e4d43fa6b80288568304f687ed36f49f |
|---|
| 245 | ] |
|---|
| 246 | [Bump version number |
|---|
| 247 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101104223731 |
|---|
| 248 | Ignore-this: 3fb2760ba56b833fb97b958f9bd400b6 |
|---|
| 249 | ] |
|---|
| 250 | [TAG 0.7 |
|---|
| 251 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100920002654 |
|---|
| 252 | Ignore-this: 77ac1b66fdd584f1c40e4e1597c228c |
|---|
| 253 | ] |
|---|
| 254 | Patch bundle hash: |
|---|
| 255 | 6d748b352e214c374d2e0b6695d8d3f6f762f740 |
|---|