Extension (Protocol)fwcd.swift-utils 4.6.2all tags
Sequence (ext)
You’re viewing third-party extensions to Sequence
, a protocol from the Swift standard library.
You can also read the documentation forSequence
itself.
extension Sequence
You’re viewing third-party extensions to Sequence
, a protocol from the Swift standard library.
You can also read the documentation forSequence
itself.
extension Sequence
protocol Sequence<Element>
A type that provides sequential, iterated access to its elements.
import Utils
func asyncCompactMap<T>(_ transform: (Element) async throws -> T?) async rethrows -> [T]
func asyncFilter(_ predicate: (Element) async throws -> Bool) async rethrows -> [Element]
func asyncFlatMap<T, S>(_ transform: (Element) async throws -> S) async rethrows -> [T] where T == S.Element, S : Sequence
func asyncMap<T>(_ transform: (Element) async throws -> T) async rethrows -> [T]
func count(forWhich predicate: (Element) throws -> Bool) rethrows -> Int
func groupingPreservingOrder<K>(by mapper: (Element) throws -> K) rethrows -> [(K, [Element])] where K : Hashable
func reduce1(_ accumulator: (Element, Element) throws -> Element) rethrows -> Element?
Reduce, but without an initial element
func scan<T>(_ initial: T, _ accumulator: (T, Element) throws -> T) rethrows -> [T]
Similar to reduce, but returns a list of successive reduced values from the left
func scan1(_ accumulator: (Element, Element) throws -> Element) rethrows -> [Element]
Similar to scan, but without an initial element
func sequenceMap<T>(_ transform: (Element) throws -> T?) rethrows -> [T]?
Turns a list of optionals into an optional list, like Haskell’s ‘sequence’.
func withoutDuplicates<T>(by mapper: (Element) throws -> T) rethrows -> [Element] where T : Hashable
func grouped<K>(by mapper: (Element) throws -> K) rethrows -> [(K, [Element])] where K : Hashable
protocol LowBoundedIntRange : Sequence where Self.Element == Int