@[extern lean_array_fset]
def
Array.set
{α : Type u_1}
(a : Array α)
(i : Nat)
(v : α)
(h : i < a.size := by get_elem_tactic)
:
Array α
Set an element in an array, using a proof that the index is in bounds. (This proof can usually be omitted, and will be synthesized automatically.)
This will perform the update destructively provided that a
has a reference
count of 1 when called.
Equations
- a.set i v h = { toList := a.toList.set i v }
Instances For
@[inline]
Set an element in an array, or do nothing if the index is out of bounds.
This will perform the update destructively provided that a
has a reference
count of 1 when called.
Instances For
@[reducible, inline, deprecated Array.setIfInBounds]
Equations
Instances For
@[extern lean_array_set]
Set an element in an array, or panic if the index is out of bounds.
This will perform the update destructively provided that a
has a reference
count of 1 when called.
Equations
- a.set! i v = a.setIfInBounds i v