def
d_array.iterate_aux
{n : ℕ}
{α : fin n → Type u}
{β : Type w}
(a : d_array n α)
(f : Π (i : fin n), α i → β → β)
(i : ℕ) :
i ≤ n → β → β
Equations
- a.iterate_aux f (j + 1) h b = let i : fin n := ⟨j, h⟩ in f i (a.read i) (a.iterate_aux f j _ b)
- a.iterate_aux f 0 h b = b
Fold over the elements of the given array in ascending order. Has builtin VM implementation.
Equations
- a.iterate b f = a.iterate_aux f n d_array.iterate._proof_1 b
def
d_array.rev_iterate_aux
{n : ℕ}
{α : fin n → Type u}
{β : Type w}
(a : d_array n α)
(f : Π (i : fin n), α i → β → β)
(i : ℕ) :
i ≤ n → β → β
Equations
- a.rev_iterate_aux f (j + 1) h b = let i : fin n := ⟨j, h⟩ in a.rev_iterate_aux f j _ (f i (a.read i) b)
- a.rev_iterate_aux f 0 h b = b
Equations
- a.rev_iterate b f = a.rev_iterate_aux f n d_array.rev_iterate._proof_1 b
@[instance]
def
d_array.decidable_eq
{n : ℕ}
{α : fin n → Type u}
[Π (i : fin n), decidable_eq (α i)] :
decidable_eq (d_array n α)
Equations
- a.read i = d_array.read a i
Equations
- a.write i v = d_array.write a i v
Fold array starting from 0, folder function includes an index argument.
Equations
- a.iterate b f = d_array.iterate a b f
Map each element of the given array with an index argument.
Equations
- a.foreach f = d_array.foreach a f
Equations
- a.rev_iterate b f = d_array.rev_iterate a b f
Equations
- a.rev_foldl b f = a.rev_iterate b (λ (_x : fin n), 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 : ℕ) :
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
Map a function over the array.
Equations
- a.map f = d_array.map (λ (_x : fin n), f) a
@[instance]
Equations
- array.has_mem = {mem := array.mem α}
@[instance]
Equations
@[instance]
@[instance]
def
array.has_to_tactic_format
{n : ℕ}
{α : Type u}
[has_to_tactic_format α] :
has_to_tactic_format (array n α)
@[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)