filter(_:)
Returns the elements of self
that satisfy isIncluded
.
func filter(_ isIncluded: @escaping (Self.Elements.Element) -> Bool) -> LazyFilterSequence<Self.Elements>
Returns the elements of self
that satisfy isIncluded
.
func filter(_ isIncluded: @escaping (Self.Elements.Element) -> Bool) -> LazyFilterSequence<Self.Elements>
ss20LazySequenceProtocolPsE6filterys0a6FilterB0Vy8ElementsQzGSb7ElementQzcF
What are these?59PL0
import Swift
protocol LazySequenceProtocol : Sequence
A sequence on which normally-eager sequence operations are implemented lazily.
associatedtype Elements : Sequence = Self where Self.Element == Self.Elements.Element
A Sequence
that can contain the same elements as this one, possibly with a simpler type.
associatedtype Element where Self.Element == Self.Iterator.Element
A type representing the sequence’s elements.
@frozen struct Bool
A value type whose instances are either true
or false
.
@frozen struct LazyFilterSequence<Base> where Base : Sequence
A sequence whose elements consist of the elements of some base sequence that also satisfy a given predicate.
var lazy: LazySequence<Self.Elements> { get }
func compactMap<ElementOfResult>(_ transform: @escaping (Self.Elements.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult>
Returns the non-nil
results of mapping the given transformation over this sequence.
func drop(while predicate: @escaping (Self.Elements.Element) -> Bool) -> LazyDropWhileSequence<Self.Elements>
Returns a lazy sequence that skips any initial elements that satisfy predicate
.
func flatMap<SegmentOfResult>(_ transform: @escaping (Self.Elements.Element) -> SegmentOfResult) -> LazySequence<FlattenSequence<LazyMapSequence<Self.Elements, SegmentOfResult>>> where SegmentOfResult : Sequence
Returns the concatenated results of mapping the given transformation over this sequence.
func map<U>(_ transform: @escaping (Self.Element) -> U) -> LazyMapSequence<Self.Elements, U>
Returns a LazyMapSequence
over this Sequence
. The elements of the result are computed lazily, each time they are read, by calling transform
function on a base element.
func prefix(while predicate: @escaping (Self.Elements.Element) -> Bool) -> LazyPrefixWhileSequence<Self.Elements>
Returns a lazy sequence of the initial consecutive elements that satisfy predicate
.
func flatMap<ElementOfResult>(_ transform: @escaping (Self.Elements.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult>
Returns the non-nil
results of mapping the given transformation over this sequence.