- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 60字
- 2021-07-02 23:54:27
The map function
The map function is a higher-order function that solves the problem of transforming the elements of an array using a function. Consider the following example:
let numbers = [10, 30, 91, 50, 100, 39, 74]
var formattedNumbers: [String] = []
for number in numbers {
let formattedNumber = "\(number)$"
formattedNumbers.append(formattedNumber)
}
let mappedNumbers = numbers.map{ "\($0)$" }
推薦閱讀
- 漫話大數據
- 企業數字化創新引擎:企業級PaaS平臺HZERO
- Unity 5.x Game AI Programming Cookbook
- Access 2016數據庫技術及應用
- UDK iOS Game Development Beginner's Guide
- 數亦有道:Python數據科學指南
- Unreal Engine Virtual Reality Quick Start Guide
- 數據挖掘算法實踐與案例詳解
- SQL進階教程(第2版)
- Unity 4.x Game AI Programming
- Discovering Business Intelligence Using MicroStrategy 9
- Access數據庫教程(2010版)
- 大數據架構師指南
- 構建最高可用Oracle數據庫系統:Oracle 11gR2RAC管理、維護與性能優化
- 數據分析師寶典