Instance Property

lazy

A view onto this collection that provides lazy implementations of normally eager operations, such as map and filter.

Declaration

var lazy: LazyRandomAccessCollection<Array<Element>> { get }

Discussion

Use the lazy property when chaining operations to prevent intermediate operations from allocating storage, or when you only need a part of the final collection to avoid unnecessary computation.

See Also

Transforming an Array

func map<T>((Element) -> T)

Returns an array containing the results of mapping the given closure over the sequence’s elements.

func map<T>((Element) -> T)

Returns an array containing the results of mapping the given closure over the sequence’s elements.

func reduce<Result>(Result, (Result, Element) -> Result)

Returns the result of combining the elements of the sequence using the given closure.

func reduce<Result>(into: Result, (inout Result, Element) -> ())

Returns the result of combining the elements of the sequence using the given closure.

var lazy: LazyCollection<Array<Element>>

A view onto this collection that provides lazy implementations of normally eager operations, such as map and filter.

var lazy: LazySequence<Array<Element>>

A sequence containing the same elements as this sequence, but on which some operations, such as map and filter, are implemented lazily.

var lazy: LazyBidirectionalCollection<Array<Element>>

A view onto this collection that provides lazy implementations of normally eager operations, such as map and filter.