LazySequence

A sequence that forwards its implementation to an underlying sequence instance while exposing lazy computations as methods.

Inheritance SequenceType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
  • Generator = S.Generator

Type alias inferred.

  • Element = Generator.Element

Type alias inferred.

Import
  • import Swift

Initializers

init(_:)

Construct an instance with base as its underlying sequence instance.

Declaration

  • init(_ base: S)

Instance Variables

var array: [S.Generator.Element]

an Array, created on-demand, containing the elements of this lazy SequenceType.

Declaration

  • var array: [S.Generator.Element] { get }

Instance Methods

func filter(_:)

Return a lazy SequenceType containing the elements x of source for which includeElement(x) is true

Declaration

func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)

Declaration

  • func generate() -> S.Generator
func map(_:)

Return a MapSequenceView over this LazySequence. The elements of the result are computed lazily, each time they are read, by calling transform function on a base element.

Declaration