span package:vector

O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

>>> import qualified Data.Vector as V

>>> V.span (<4) $ V.generate 10 id
([0,1,2,3],[4,5,6,7,8,9])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

>>> import qualified Data.Vector.Strict as V

>>> V.span (<4) $ V.generate 10 id
([0,1,2,3],[4,5,6,7,8,9])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

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

>>> VP.span (<4) $ VP.generate 10 id
([0,1,2,3],[4,5,6,7,8,9])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

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

>>> VS.span (<4) $ VS.generate 10 id
([0,1,2,3],[4,5,6,7,8,9])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

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

>>> VU.span (<4) $ VU.generate 10 id
([0,1,2,3],[4,5,6,7,8,9])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

>>> import qualified Data.Vector as V

>>> V.spanR (>4) $ V.generate 10 id
([5,6,7,8,9],[0,1,2,3,4])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

>>> import qualified Data.Vector.Strict as V

>>> V.spanR (>4) $ V.generate 10 id
([5,6,7,8,9],[0,1,2,3,4])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

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

>>> VP.spanR (>4) $ VP.generate 10 id
([5,6,7,8,9],[0,1,2,3,4])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

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

>>> VS.spanR (>4) $ VS.generate 10 id
([5,6,7,8,9],[0,1,2,3,4])
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. Does not fuse.

Examples

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

>>> VU.spanR (>4) $ VU.generate 10 id
([5,6,7,8,9],[0,1,2,3,4])