Sha256: bed29b868678e9c01528970bc9afe399a90a5562e3bf770b5609918b8a0a52ee

Contents?: true

Size: 213 Bytes

Versions: 396

Compression:

Stored size: 213 Bytes

Contents

extension Array {
    func accumulate<S>(_ yield: (Element) -> S) -> [S] {
        var result: [S] = [S]()
        for item in self {
            result.append(yield(item))
        }
        return result
    }
}

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.138 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.137 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.136 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.135 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.134 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.133 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.132 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.131 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.130 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.129 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.128 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.127 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.126 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.125 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.124 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.123 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.122 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.121 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift
trackler-2.2.1.120 tracks/swift/exercises/accumulate/Sources/AccumulateExample.swift