iterateN package:vector

O(n) Apply the function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. <math>

Examples

>>> import qualified Data.Vector as V

>>> V.iterateN 0 undefined undefined :: V.Vector String
[]

>>> V.iterateN 4 (\x -> x <> x) "Hi"
["Hi","HiHi","HiHiHiHi","HiHiHiHiHiHiHiHi"]
O(n) Apply function <math> times to an initial value, producing a pure bundle of exact length <math>. Zeroth element will contain the initial value.
O(n) Apply function <math> times to an initial value, producing a monadic bundle of exact length <math>. Zeroth element will contain the initial value.
O(n) Apply the function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. <math>
O(n) Apply the function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. <math>

Examples

>>> import qualified Data.Vector.Primitive as VP

>>> VP.iterateN 0 undefined undefined :: VP.Vector Int
[]

>>> VP.iterateN 26 succ 'a'
"abcdefghijklmnopqrstuvwxyz"
O(n) Apply the function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. <math>

Examples

>>> import qualified Data.Vector.Storable as VS

>>> VS.iterateN 0 undefined undefined :: VS.Vector Int
[]

>>> VS.iterateN 26 succ 'a'
"abcdefghijklmnopqrstuvwxyz"
O(n) Apply the function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. <math>

Examples

>>> import qualified Data.Vector.Unboxed as VU

>>> VU.iterateN 0 undefined undefined :: VU.Vector Int
[]

>>> VU.iterateN 3 (\(i, c) -> (pred i, succ c)) (0 :: Int, 'a')
[(0,'a'),(-1,'b'),(-2,'c')]
O(n) Apply the monadic function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. For a non-monadic version, see iterateN.
O(n) Apply monadic function <math> times to an initial value, producing a monadic bundle of exact length <math>. Zeroth element will contain the initial value.
O(n) Apply the monadic function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. For a non-monadic version, see iterateN.
O(n) Apply the monadic function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. For a non-monadic version, see iterateN.
O(n) Apply the monadic function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. For a non-monadic version, see iterateN.
O(n) Apply the monadic function <math> times to an initial value, producing a vector of length <math>. The 0th element will contain the initial value, which is why there is one less function application than the number of elements in the produced vector. For a non-monadic version, see iterateN.