FilterIndex
public protocol FilterIndex
FilterIndex
provides a Traversal
for this structure with all its foci FilterIndexFoci
whose index FilterIndexType
satisfies a predicate.
-
Undocumented
Declaration
Swift
associatedtype FilterIndexType
-
Undocumented
Declaration
Swift
associatedtype FilterIndexFoci
-
Filters the foci of a
Traversal
with a predicate.Declaration
Swift
static func filter(_ predicate: @escaping (FilterIndexType) -> Bool) -> Traversal<Self, FilterIndexFoci>
Parameters
predicate
A predicate to filter the indices of this structure.
Return Value
A
Traversal
between this structure and its foci whose indices match the provided predicate.
-
filter(_:iso:)
Extension methodPre-composes the
Traversal
provided by thisFilterIndex
with an isomorphism.Declaration
Swift
static func filter<B>(_ predicate: @escaping (FilterIndexType) -> Bool, iso: Iso<B, Self>) -> Traversal<B, FilterIndexFoci>
Parameters
predicate
A predicate to filter the indices of this structure.
iso
An isomorphism.
Return Value
A
Traversal
over a structure that is isomorphic to this one, and has the same foci. -
filter(_:iso:)
Extension methodPost-composes the
Traversal
provided by theFilterIndex
with an isomorphism.Declaration
Swift
static func filter<B>(_ predicate: @escaping (FilterIndexType) -> Bool, iso: Iso<FilterIndexFoci, B>) -> Traversal<Self, B>
Parameters
predicate
A predicate to filter the indices of this structure.
iso
An isomorphism.
Return Value
A
Traversal
between this structure and new foci that is isomorphic to the original ones. -
filter(_:zipWithIndex:)
Extension methodProvides a
Traversal
when this structure has an instance ofTraverse
.Declaration
Swift
static func filter<F: Traverse, A>(_ predicate: @escaping (FilterIndexType) -> Bool, zipWithIndex: @escaping (Kind<F, A>) -> Kind<F, (A, FilterIndexType)>) -> Traversal<Kind<F, A>, A> where Self: Kind<F, A>, A == FilterIndexFoci
Parameters
predicate
A predicate to filter the indices of this structure.
zipWithIndex
A function that associates an index to each value inside this structure.`
Return Value
A
Traversal
over the elements of thisTraverse
structure whose indices match the predicate.