$ swift Welcome to Apple Swift version 4.0 (swiftlang-900.0.63.10 clang-900.0.36). Type :help for assistance. 1> extension Array where Element == Double { 2. var mean: Double { 3. return reduce(0) { $0 + $1 } / Double(count) 4. } 5. } 6> [0.007428, 0.000827, 0.000812, 0.000774, 0.000730, 0.000669, 0.000670, 0.000671, 0.000672, 0.000674].mean // testForLoop $R0: Double = 0.0013927 7> [0.001285, 0.001151, 0.001017, 0.001008, 0.000957, 0.000841, 0.000824, 0.000814, 0.000818, 0.000849].mean // testLazyMapReduce $R1: Double = 0.00095639999999999993 8> [0.008967, 0.003619, 0.003361, 0.003240, 0.003070, 0.003096, 0.003307, 0.003079, 0.003139, 0.003077].mean // testMapReduce $R2: Double = 0.0037955000000000003 9> [0.001513, 0.001253, 0.001021, 0.000973, 0.000968, 0.000928, 0.000814, 0.001816, 0.001165, 0.000897].mean // testReduce $R4: Double = 0.0011348