In the VM, d_array is implemented as a persistent array.
Instances for d_array
- d_array.has_sizeof_inst
- d_array.inhabited
- d_array.has_variable_names
- d_array.fintype
def
d_array.rev_iterate
{n : ℕ}
{α : fin n → Type u}
{β : Type w}
(a : d_array n α)
(b : β)
(f : Π (i : fin n), α i → β → β) :
β
Equations
- a.rev_iterate b f = a.rev_iterate_aux f n d_array.rev_iterate._proof_1 b
@[protected, instance]
def
d_array.decidable_eq
{n : ℕ}
{α : fin n → Type u}
[Π (i : fin n), decidable_eq (α i)] :
decidable_eq (d_array n α)
A non-dependent array (see d_array
). Implemented in the VM as a persistent array.
Equations
- a.read i = d_array.read a i
Equations
- a.write i v = d_array.write a i v
def
array.rev_iterate
{n : ℕ}
{α : Type u}
{β : Type v}
(a : array n α)
(b : β)
(f : fin n → α → β → β) :
β
Equations
- a.rev_iterate b f = d_array.rev_iterate a b f
push_back a v
pushes value v
to the end of the array. Has builtin VM implementation.
def
array.mmap_core
{n : ℕ}
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[monad m]
(a : array n α)
(f : α → m β)
(i : ℕ)
(H : i ≤ n) :
m (array i β)
Auxilliary function for monadically mapping a function over an array.
Equations
- a.mmap_core f (i + 1) h = a.mmap_core f i _ >>= λ (bs : array i β), f (a.read ⟨i, h⟩) >>= λ (b : β), has_pure.pure (bs.push_back b)
- a.mmap_core f 0 _x = has_pure.pure d_array.nil
@[protected, instance]
Equations
@[protected, instance]
Equations
- array.decidable_eq = array.decidable_eq._proof_1.mpr (λ (a b : d_array n (λ (_x : fin n), α)), d_array.decidable_eq a b)