<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/LazySequence/LazySequenceProtocol-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "LazySequenceProtocol Implementations"
}
-->

# LazySequenceProtocol Implementations

## Topics

### Instance Properties

[`var elements: LazySequence<Base>.Elements`](/documentation/Swift/LazySequence/elements-swift.property)

The `Base` (presumably non-lazy) sequence from which `self` was created.

[`var lazy: LazySequence<Self.Elements>`](/documentation/Swift/LazySequence/lazy)

### Instance Methods

[`func compactMap<ElementOfResult>((Self.Elements.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult>`](/documentation/Swift/LazySequence/compactMap(_:)-73i9g)

Returns the non-`nil` results of mapping the given transformation over
this sequence.

[`func drop(while: (Self.Elements.Element) -> Bool) -> LazyDropWhileSequence<Self.Elements>`](/documentation/Swift/LazySequence/drop(while:))

Returns a lazy sequence that skips any initial elements that satisfy
`predicate`.

[`func filter((Self.Elements.Element) -> Bool) -> LazyFilterSequence<Self.Elements>`](/documentation/Swift/LazySequence/filter(_:))

Returns the elements of `self` that satisfy `isIncluded`.

[`func flatMap<ElementOfResult>((Self.Elements.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult>`](/documentation/Swift/LazySequence/flatMap(_:)-102bh)

Returns the non-`nil` results of mapping the given transformation over
this sequence.

[`func flatMap<SegmentOfResult>((Self.Elements.Element) -> SegmentOfResult) -> LazySequence<FlattenSequence<LazyMapSequence<Self.Elements, SegmentOfResult>>>`](/documentation/Swift/LazySequence/flatMap(_:)-7fl2l)

Returns the concatenated results of mapping the given transformation over
this sequence.

[`func joined() -> LazySequence<FlattenSequence<Self.Elements>>`](/documentation/Swift/LazySequence/joined()-2zoe4)

Returns a lazy sequence that concatenates the elements of this sequence of
sequences.

[`func map<U>((Self.Element) -> U) -> LazyMapSequence<Self.Elements, U>`](/documentation/Swift/LazySequence/map(_:)-5eh3s)

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: (Self.Elements.Element) -> Bool) -> LazyPrefixWhileSequence<Self.Elements>`](/documentation/Swift/LazySequence/prefix(while:))

Returns a lazy sequence of the initial consecutive elements that satisfy
`predicate`.

### Type Aliases

[`typealias Elements`](/documentation/Swift/LazySequence/Elements-swift.typealias)

A `Sequence` that can contain the same elements as this one,
possibly with a simpler type.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)