@[implemented_by _private.Init.Data.Array.Attach.0.Array.attachWithImpl]
def
Array.attachWith
{α : Type u_1}
(xs : Array α)
(P : α → Prop)
(H : ∀ (x : α), x ∈ xs → P x)
:
Array { x : α // P x }
O(1)
. "Attach" a proof P x
that holds for all the elements of xs
to produce a new array
with the same elements but in the type {x // P x}
.
Equations
- xs.attachWith P H = { data := xs.data.attachWith P ⋯ }