Equations
- instReprVector = { reprPrec := reprVector✝ }
Equations
Syntax for Vector α n
Equations
- One or more equations did not get rendered due to their size.
Instances For
Custom eliminator for Vector α n
through Array α
Equations
- Vector.elimAsArray mk { toArray := a, size_toArray := ha } = mk a ha
Instances For
Custom eliminator for Vector α n
through List α
Equations
- Vector.elimAsList mk { toList := a, size_toArray := ha } = mk a ha
Instances For
Make an empty vector with pre-allocated capacity.
Equations
- Vector.mkEmpty capacity = { toArray := Array.mkEmpty capacity, size_toArray := ⋯ }
Instances For
Makes a vector of size n
with all cells containing v
.
Equations
- Vector.mkVector n v = { toArray := mkArray n v, size_toArray := ⋯ }
Instances For
Returns a vector of size 1
with element v
.
Equations
- Vector.singleton v = { toArray := #[v], size_toArray := ⋯ }
Instances For
Equations
- Vector.instInhabited = { default := Vector.mkVector n default }
Equations
- Vector.instMembership = { mem := Vector.Mem }
Set an element in a vector using a Nat
index, with a tactic provided proof that the index is in
bounds.
This will perform the update destructively provided that the vector has a reference count of 1.
Instances For
Set an element in a vector using a Nat
index. Returns the vector unchanged if the index is out of
bounds.
This will perform the update destructively provided that the vector has a reference count of 1.
Equations
- v.setIfInBounds i x = { toArray := v.setIfInBounds i x, size_toArray := ⋯ }
Instances For
Set an element in a vector using a Nat
index. Panics if the index is out of bounds.
This will perform the update destructively provided that the vector has a reference count of 1.
Instances For
Equations
- Vector.foldlM f b v = Array.foldlM f b v.toArray
Instances For
Equations
- Vector.foldrM f b v = Array.foldrM f b v.toArray
Instances For
Equations
- Vector.foldl f b v = Array.foldl f b v.toArray
Instances For
Equations
- Vector.foldr f b v = Array.foldr f b v.toArray
Instances For
Equations
- Vector.instHAppendHAddNat = { hAppend := Vector.append }
Creates a vector from another with a provably equal length.
Equations
- Vector.cast h v = { toArray := v.toArray, size_toArray := ⋯ }
Instances For
Extracts the slice of a vector from indices start
to stop
(exclusive). If start ≥ stop
, the
result is empty. If stop
is greater than the size of the vector, the size is used instead.
Instances For
Extract the first m
elements of a vector. If m
is greater than or equal to the size of the
vector then the vector is returned unchanged.
Instances For
Deletes the first m
elements of a vector. If m
is greater than or equal to the size of the
vector then the empty vector is returned.
Instances For
Maps elements of a vector using the function f
, which also receives the index of the element.
Equations
- Vector.mapIdx f v = { toArray := Array.mapIdx f v.toArray, size_toArray := ⋯ }
Instances For
Maps elements of a vector using the function f
,
which also receives the index of the element, and the fact that the index is less than the size of the vector.
Equations
Instances For
Map a monadic function over a vector.
Equations
- Vector.mapM f v = Vector.mapM.go f v 0 ⋯ { toArray := #[], size_toArray := ⋯ }
Instances For
Equations
- Vector.mapM.go f v i h r = if h' : i < n then do let __do_lift ← f v[i] Vector.mapM.go f v (i + 1) ⋯ (r.push __do_lift) else pure (Vector.cast ⋯ r)
Instances For
Equations
- Vector.flatMapM.go v f i h r = if h' : i < n then do let __do_lift ← f v[i] Vector.flatMapM.go v f (i + 1) ⋯ (Vector.cast ⋯ (r ++ __do_lift)) else pure (Vector.cast ⋯ r)
Instances For
Variant of mapIdxM
which receives the index i
along with the bound `i < n.
Equations
- as.mapFinIdxM f = Vector.mapFinIdxM.map as f n 0 ⋯ (Vector.cast ⋯ { toArray := #[], size_toArray := ⋯ })
Instances For
Equations
- Vector.mapFinIdxM.map as f 0 j x bs_2 = pure bs_2
- Vector.mapFinIdxM.map as f i_2.succ j inv_2 bs_2 = do let __do_lift ← f j as[j] ⋯ Vector.mapFinIdxM.map as f i_2 (j + 1) ⋯ (Vector.cast ⋯ (bs_2.push __do_lift))
Instances For
Equations
- Vector.firstM f as = Array.firstM f as.toArray
Instances For
Equations
Instances For
Maps corresponding elements of two vectors of equal size using the function f
.
Equations
- Vector.zipWith f a b = { toArray := Array.zipWith f a.toArray b.toArray, size_toArray := ⋯ }
Instances For
The vector of length n
whose i
-th element is f i
.
Equations
- Vector.ofFn f = { toArray := Array.ofFn f, size_toArray := ⋯ }
Instances For
Swap two elements of a vector using Fin
indices.
This will perform the update destructively provided that the vector has a reference count of 1.
Instances For
Swap two elements of a vector using Nat
indices. Panics if either index is out of bounds.
This will perform the update destructively provided that the vector has a reference count of 1.
Equations
- v.swapIfInBounds i j = { toArray := v.swapIfInBounds i j, size_toArray := ⋯ }
Instances For
Swaps an element of a vector with a given value using a Fin
index. The original value is returned
along with the updated vector.
This will perform the update destructively provided that the vector has a reference count of 1.
Equations
Instances For
Swaps an element of a vector with a given value using a Nat
index. Panics if the index is out of
bounds. The original value is returned along with the updated vector.
This will perform the update destructively provided that the vector has a reference count of 1.
Equations
Instances For
The vector #v[0, 1, 2, ..., n-1]
.
Equations
- Vector.range n = { toArray := Array.range n, size_toArray := ⋯ }
Instances For
The vector #v[start, start + step, start + 2 * step, ..., start + (size - 1) * step]
.
Equations
- Vector.range' start size step = { toArray := Array.range' start size step, size_toArray := ⋯ }
Instances For
Compares two vectors of the same size using a given boolean relation r
. isEqv v w r
returns
true
if and only if r v[i] w[i]
is true for all indices i
.
Instances For
Delete an element of a vector using a Nat
index. Panics if the index is out of bounds.
Equations
Instances For
Finds the first index of a given value in a vector using ==
for comparison. Returns none
if the
no element of the index matches the given value.
Equations
- v.finIdxOf? x = Option.map (Fin.cast ⋯) (v.finIdxOf? x)
Instances For
Equations
Instances For
Finds the first index of a given value in a vector using a predicate. Returns none
if the
no element of the index matches the given value.
Equations
- Vector.findFinIdx? p v = Option.map (Fin.cast ⋯) (Array.findFinIdx? p v.toArray)
Instances For
Note that the universe level is contrained to Type
here,
to avoid having to have the predicate live in p : α → m (ULift Bool)
.
Equations
- Vector.findM? f as = Array.findM? f as.toArray
Instances For
Equations
- Vector.findSomeM? f as = Array.findSomeM? f as.toArray
Instances For
Note that the universe level is contrained to Type
here,
to avoid having to have the predicate live in p : α → m (ULift Bool)
.
Equations
- Vector.findRevM? f as = Array.findRevM? f as.toArray
Instances For
Equations
- Vector.findSomeRevM? f as = Array.findSomeRevM? f as.toArray
Instances For
Equations
- Vector.findSome? f as = Array.findSome? f as.toArray
Instances For
Equations
- Vector.findSomeRev? f as = Array.findSomeRev? f as.toArray
Instances For
Returns true
when v
is a prefix of the vector w
.
Equations
- v.isPrefixOf w = v.isPrefixOf w.toArray
Instances For
Returns true
with the monad if p
returns true
for any element of the vector.
Equations
- Vector.anyM p v = Array.anyM p v.toArray
Instances For
Returns true
with the monad if p
returns true
for all elements of the vector.
Equations
- Vector.allM p v = Array.allM p v.toArray
Instances For
Count the number of elements of a vector that satisfy the predicate p
.
Equations
- Vector.countP p v = Array.countP p v.toArray
Instances For
Count the number of elements of a vector that are equal to a
.
Equations
- Vector.count a v = Array.count a v.toArray
Instances For
ForIn instance #
Equations
- One or more equations did not get rendered due to their size.
ForM instance #
Equations
- Vector.instForM = { forM := fun [Monad m] => Vector.forM }
ToStream instance #
Equations
- Vector.instToStreamSubarray = { toStream := fun (v : Vector α n) => v.toSubarray 0 n }
Lexicographic ordering #
Lexicographic comparator for vectors.
lex v w lt
is true if
v
is pairwise equivalent via==
tow
, or- there is an index
i
such thatlt v[i] w[i]
, and for allj < i
,v[j] == w[j]
.
Equations
- One or more equations did not get rendered due to their size.