Idris2Doc : Data.Vect

# Data.Vect

(++) : Vectmelem -> Vectnelem -> Vect (m+n) elem
`  Append two vectors    ```idris example  [1,2,3,4] ++ [5,6]  ````

Totality: total
Fixity Declaration: infixr operator, level 7
dataVect : Nat -> Type -> Type
Totality: total
Constructors:
Nil : Vect0elem
`  Empty vector`
(::) : elem -> Vectlenelem -> Vect (Slen) elem
`  A non-empty vector of length `S len`, consisting of a head element and  the rest of the list, of length `len`.`
catMaybes : Vectn (Maybeelem) -> DPairNat (\p => Vectpelem)
`  Filter out Nothings from Vect and unwrap the Justs    ```idris example  catMaybes [Just 1, Just 2, Nothing, Nothing, Just 5]  ````

Totality: total
concat : Vectm (Vectnelem) -> Vect (m*n) elem
`  Flatten a vector of equal-length vectors    ```idris example  concat [[1,2,3], [4,5,6]]  ````

Totality: total
delete : Eqelem => elem -> Vectlenelem -> DPairNat (\p => Vectpelem)
`  Delete first element from list equal to the given one    ```idris example  delete 2 (fromList [1,2,2,3,4,4])  ````

Totality: total
deleteAt : Fin (Slen) -> Vect (Slen) elem -> Vectlenelem
`  Construct a new vector consisting of all but the indicated element    ```idris example  deleteAt 1 [1,2,3,4]  ````

Totality: total
deleteBy : (elem -> elem -> Bool) -> elem -> Vectlenelem -> DPairNat (\p => Vectpelem)
`  Delete first element from list according to some test    ```idris example  deleteBy (<) 3 (fromList [1,2,2,3,4,4])  ````

Totality: total
diag : Vectlen (Vectlenelem) -> Vectlenelem
`  Get diagonal elements    ```idris example  diag [[1,2,3], [4,5,6], [7,8,9]]  ````

Totality: total
drop : (n : Nat) -> Vect (n+m) elem -> Vectmelem
`  Drop the first `n` elements of a Vect.`

Totality: total
drop' : (n : Nat) -> Vectlelem -> Vect (minusln) elem
`  Drop up to the first `n` elements of a Vect.`

Totality: total
elem : Eqelem => elem -> Vectlenelem -> Bool
`  Use the default Boolean equality on elements to search for an item  @ x what to search for  @ xs where to search    ```idris example  elem 3 [1,2,3,4]  ````

Totality: total
elemBy : (elem -> elem -> Bool) -> elem -> Vectlenelem -> Bool
`  Search for an item using a user-provided test  @ p the equality test  @ e the item to search for  @ xs the vector to search in    ```idris example  elemBy (==) 2 [1,2,3,4]  ````

Totality: total
elemIndex : Eqelem => elem -> Vectmelem -> Maybe (Finm)
`  Find the index of the first element of the vector equal to the given one.    ```idris example  elemIndex 3 [1,2,3,4]  ````

Totality: total
elemIndexBy : (elem -> elem -> Bool) -> elem -> Vectmelem -> Maybe (Finm)
`  Find the index of the first element of the vector that satisfies some test    ```idris example  elemIndexBy (==) 3 [1,2,3,4]  ````

Totality: total
elemIndices : Eqelem => elem -> Vectmelem -> List (Finm)
`  Find the indices of all elements uquals to the given one    ```idris example  elemIndices 3 [1,2,3,4,3]  ````

Totality: total
elemIndicesBy : (elem -> elem -> Bool) -> elem -> Vectmelem -> List (Finm)
`  Find the indices of all elements that satisfy some test    ```idris example  elemIndicesBy (<=) 3 [1,2,3,4]  ````

Totality: total
exactLength : (len : Nat) -> Vectma -> Maybe (Vectlena)
Totality: total
filter : (elem -> Bool) -> Vectlenelem -> DPairNat (\p => Vectpelem)
`  Find all elements of a vector that satisfy some test    ```idris example  filter (< 3) (fromList [1,2,3,4])  ````

Totality: total
find : (elem -> Bool) -> Vectlenelem -> Maybeelem
`  Find the first element of the vector that satisfies some test  @ p the test to satisfy    ```idris example  find (== 3) [1,2,3,4]  ````

Totality: total
findIndex : (elem -> Bool) -> Vectlenelem -> Maybe (Finlen)
`  Find the index of the first element of the vector that satisfies some test    ```idris example  findIndex (== 3) [1,2,3,4]  ````

Totality: total
findIndices : (elem -> Bool) -> Vectmelem -> List (Finm)
`  Find the indices of all elements that satisfy some test    ```idris example  findIndices (< 3) [1,2,3,4]  ````

Totality: total
foldl1 : (t -> t -> t) -> Vect (Sn) t -> t
`  Foldl without seeding the accumulator    ```idris example  foldl1 (-) (fromList [1,2,3])  ````

Totality: total
foldr1 : (t -> t -> t) -> Vect (Sn) t -> t
`  Foldr without seeding the accumulator    ```idris example  foldr1 (-) (fromList [1,2,3])  ````

Totality: total
foldrImpl : (t -> acc -> acc) -> acc -> (acc -> acc) -> Vectnt -> acc
Totality: total
fromList : (xs : Listelem) -> Vect (lengthxs) elem
`  Convert a list to a vector.    The length of the list should be statically known.    ```idris example  fromList [1,2,3,4]  ````

Totality: total
fromList' : Vectlenelem -> (l : Listelem) -> Vect (lengthl+len) elem
Totality: total
hasAny : Eqelem => Vectmelem -> Vectlenelem -> Bool
`  Check if any element of xs is found in elems using the default Boolean equality test    ```idris example  hasAny [2,5] [1,2,3,4]  ````

Totality: total
hasAnyBy : (elem -> elem -> Bool) -> Vectmelem -> Vectlenelem -> Bool
`  Check if any element of xs is found in elems by a user-provided comparison  @ p the comparison operator  @ elems the vector to search  @ xs what to search for    ```idris example  hasAnyBy (==) [2,5] [1,2,3,4]  ````

Totality: total
head : Vect (Slen) elem -> elem
`  Only the first element of the vector    ```idris example  head [1,2,3,4]  ````

Totality: total
index : Finlen -> Vectlenelem -> elem
`  Extract a particular element from a vector    ```idris example  index 1 [1,2,3,4]  ````

Totality: total
init : Vect (Slen) elem -> Vectlenelem
`  All but the last element of the vector    ```idris example  init [1,2,3,4]  ````

Totality: total
insertAt : Fin (Slen) -> elem -> Vectlenelem -> Vect (Slen) elem
`  Insert an element at a particular index    ```idris example  insertAt 1 8 [1,2,3,4]  ````

Totality: total
intersperse : elem -> Vectlenelem -> Vect (len+predlen) elem
`  Alternate an element between the other elements of a vector  @ sep the element to intersperse  @ xs the vector to separate with `sep`    ```idris example  intersperse 0 [1,2,3,4]  ````

Totality: total
isPrefixOf : Eqelem => Vectmelem -> Vectlenelem -> Bool
`  Verify vector prefix    ```idris example  isPrefixOf (fromList [1,2]) (fromList [1,2,3,4])  ````

Totality: total
isPrefixOfBy : (elem -> elem -> Bool) -> Vectmelem -> Vectlenelem -> Bool
`  Verify vector prefix    ```idris example  isPrefixOfBy (==) (fromList [1,2]) (fromList [1,2,3,4])  ````

Totality: total
isSuffixOf : Eqelem => Vectmelem -> Vectlenelem -> Bool
`  Verify vector suffix    ```idris example  isSuffixOf (fromList [3,4]) (fromList [1,2,3,4])  ````

Totality: total
isSuffixOfBy : (elem -> elem -> Bool) -> Vectmelem -> Vectlenelem -> Bool
`  Verify vector suffix    ```idris example  isSuffixOfBy (==) (fromList [3,4]) (fromList [1,2,3,4])  ````

Totality: total
last : Vect (Slen) elem -> elem
`  The last element of the vector    ```idris example  last [1,2,3,4]  ````

Totality: total
length : Vectlenelem -> Nat
Totality: total
lengthCorrect : (xs : Vectlenelem) -> lengthxs = len
`  Show that the length function on vectors in fact calculates the length`

Totality: total
lookup : Eqkey => key -> Vectn (key, val) -> Maybeval
`  Find the assocation of some key using the default Boolean equality test    ```idris example  lookup 3 [(1, 'a'), (2, 'b'), (3, 'c')]  ````

Totality: total
lookupBy : (key -> key -> Bool) -> key -> Vectn (key, val) -> Maybeval
`  Find the association of some key with a user-provided comparison  @ p the comparison operator for keys (True if they match)  @ e the key to look for    ```idris example  lookupBy (==) 2 [(1, 'a'), (2, 'b'), (3, 'c')]  ````

Totality: total
mapMaybe : (a -> Maybeb) -> Vectlena -> DPairNat (\m => Vectmb)
`  Map a partial function across a vector, returning those elements for which  the function had a value.    The first projection of the resulting pair (ie the length) will always be  at most the length of the input vector. This is not, however, guaranteed  by the type.    @ f the partial function (expressed by returning `Maybe`)  @ xs the vector to check for results    ```idris example  mapMaybe ((find (=='a')) . unpack) (fromList ["abc","ade","bgh","xyz"])  ````

Totality: total
maybeToVect : Maybeelem -> DPairNat (\p => Vectpelem)
`  Convert Maybe type into Vect    ```idris example  maybeToVect (Just 2)  ````

Totality: total
merge : Ordelem => Vectnelem -> Vectmelem -> Vect (n+m) elem
Totality: total
mergeBy : (elem -> elem -> Ordering) -> Vectnelem -> Vectmelem -> Vect (n+m) elem
`  Merge two ordered vectors    ```idris example  mergeBy compare (fromList [1,3,5]) (fromList [2,3,4,5,6])  ````

Totality: total
nub : Eqelem => Vectlenelem -> DPairNat (\p => Vectpelem)
`  Make the elements of some vector unique by the default Boolean equality    ```idris example  nub (fromList [1,2,2,3,4,4])  ````

Totality: total
nubBy : (elem -> elem -> Bool) -> Vectlenelem -> DPairNat (\p => Vectpelem)
`  Make the elements of some vector unique by some test    ```idris example  nubBy (==) (fromList [1,2,2,3,4,4])  ````

Totality: total
overLength : (len : Nat) -> Vectma -> Maybe (DPairNat (\p => Vect (plusplen) a))
`  If the given Vect is at least the required length, return a Vect with  at least that length in its type, otherwise return Nothing  @len the required length  @xs the vector with the desired length`

Totality: total
partition : (elem -> Bool) -> Vectlenelem -> (DPairNat (\p => Vectpelem), DPairNat (\q => Vectqelem))
`  A tuple where the first element is a `Vect` of the `n` elements passing given test  and the second element is a `Vect` of the remaining elements of the original.    ```idris example  partition (== 2) (fromList [1,2,3,2,4])  ````

Totality: total
replaceAt : Finlen -> elem -> Vectlenelem -> Vectlenelem
`  Replace an element at a particlar index with another    ```idris example  replaceAt 1 8 [1,2,3,4]  ````

Totality: total
replaceAtDiffIndexPreserves : (xs : Vectna) -> (i : Finn) -> (j : Finn) -> Not (i = j) -> (0 y : a) -> indexi (replaceAtjyxs) = indexixs
Totality: total
replaceAtSameIndex : (xs : Vectna) -> (i : Finn) -> (0 y : a) -> indexi (replaceAtiyxs) = y
Totality: total
replicate : (len : Nat) -> elem -> Vectlenelem
`  Repeate some value some number of times.    @ len the number of times to repeat it  @ x the value to repeat    ```idris example  replicate 4 1  ````

Totality: total
reverse : Vectlenelem -> Vectlenelem
`  Reverse the order of the elements of a vector    ```idris example  reverse [1,2,3,4]  ````

Totality: total
scanl : (res -> elem -> res) -> res -> Vectlenelem -> Vect (Slen) res
`  The scanl function is similar to foldl, but returns all the intermediate  accumulator states in the form of a vector.    ```idris example  scanl (-) 0 (fromList [1,2,3])  ````

Totality: total
scanl1 : (elem -> elem -> elem) -> Vectlenelem -> Vectlenelem
`  The scanl1 function is a variant of scanl that doesn't require an explicit  starting value.  It assumes the first element of the vector to be the starting value and then  starts the fold with the element following it.    ```idris example  scanl1 (-) (fromList [1,2,3])  ````

Totality: total
snoc : Vectna -> a -> Vect (Sn) a
`  Add an element at the end of the vector.  The main use case for it is to get the expected type signature  `Vect n a -> a -> Vect (S n) a` instead of  `Vect n a -> a -> Vect (n + 1) a` which you get by using `++ [x]`    Snoc gets its name by reversing `cons`, indicating we are  tacking on the element at the end rather than the begining.  `append` would also be a suitable name.    @ xs The vector to be appended  @ v The value to append`

Totality: total
splitAt : (n : Nat) -> Vect (n+m) elem -> (Vectnelem, Vectmelem)
`  A tuple where the first element is a `Vect` of the `n` first elements and  the second element is a `Vect` of the remaining elements of the original.  It is equivalent to `(take n xs, drop n xs)` (`splitAtTakeDrop`),  but is more efficient.    @ n the index to split at  @ xs the `Vect` to split in two    ```idris example  splitAt 2 (fromList [1,2,3,4])  ````

Totality: total
tail : Vect (Slen) elem -> Vectlenelem
`  All but the first element of the vector    ```idris example  tail [1,2,3,4]  ````

Totality: total
take : (n : Nat) -> Vect (n+m) type -> Vectntype
`  Extract the first `n` elements of a Vect.`

Totality: total
toVect : (n : Nat) -> Lista -> Maybe (Vectna)
Totality: total
transpose : Vectm (Vectnelem) -> Vectn (Vectmelem)
`  Transpose a `Vect` of `Vect`s, turning rows into columns and vice versa.    This is like zipping all the inner `Vect`s together and is equivalent to `traverse id` (`transposeTraverse`).    As the types ensure rectangularity, this is an involution, unlike `Prelude.List.transpose`.    ```idris example  transpose [[1,2], [3,4], [5,6], [7,8]]  ````

Totality: total
updateAt : Finlen -> (elem -> elem) -> Vectlenelem -> Vectlenelem
`  Replace the element at a particular index with the result of applying a function to it  @ i the index to replace at  @ f the update function  @ xs the vector to replace in    ```idris example  updateAt 1 (+10) [1,2,3,4]  ````

Totality: total
vectInjective : x::xs = y::ys -> (x = y, xs = ys)
`  If two vectors are equal, their heads and tails are equal`

Totality: total
vectToMaybe : Vectlenelem -> Maybeelem
`  Convert first element of Vect (if exists) into Maybe.    ```idris example  vectToMaybe   ````

Totality: total
zipWith3IndexLinear : (0 f : (a -> a -> a -> a)) -> (xs : Vectna) -> (ys : Vectna) -> (zs : Vectna) -> (i : Finn) -> indexi (zipWith3fxsyszs) = f (indexixs) (indexiys) (indexizs)
Totality: total
zipWithIndexLinear : (0 f : (a -> a -> a)) -> (xs : Vectna) -> (ys : Vectna) -> (i : Finn) -> indexi (zipWithfxsys) = f (indexixs) (indexiys)
Totality: total