String = { (i: Int) -> String in "\(i * 2)" } // ҾʹؔΛऔΔࣄ͕ग़དྷΔ func map2<A, B>(xs: [A], f: A -> B) -> [B] { return xs.reduce([]) { (acc: [B], x: A) in acc + [f(x)] } } map2([1,2,3], f: doubleStr) // [2,4,6] map2(Array(1...3)) { $0 * 2 } // [2,4,6] • ҾʹؔΛͯ͠ॲཧΛҕৡ