profile
viewpoint

Ask questionsConsider adding scan

I remember scan(_:combine:) not making the cut on the grounds of offering low utility. Is it possible for it to find a place here?

apple/swift-algorithms

Answer questions pyrtsa

+1 on the idea.

I'd rather see the latter function with the following signature, allowing for a different result type and aligning with Sequence.reduce(_:_:):

extension Sequence {
    func scan<Result>(_ initialResult: Result, _ nextPartialResult: (Result, Element) throws -> Result) rethrows -> [Result]
}

Also a lazy counterpart for both functions seems like a useful thing to include.

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List