- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 170字
- 2021-07-02 23:54:30
Functions and Closures
In the previous chapter, we had an overview of Functional Programming (FP) and the Swift programming language. It introduced some of the key concepts of functions. As functions are the fundamental building blocks in FP, this chapter pes deeper into the subject and explains all the aspects related to the definition and usage of functions in Swift and FP, together with coding examples.
This chapter starts with the Swift function and method syntax, continues with other related topics such as function types and tuples, and finally concludes with FP topics such as first-class functions, higher-order functions, function composition, closures, currying, recursion, and memoization.
This chapter will cover the following topics by coding examples:
- General syntax of functions
- Defining and using function parameters
- Setting internal and external parameters
- Setting default parameter values
- Defining and using variadic functions
- Returning values from functions
- Defining and using nested functions
- Function types
- Pure functions
- First class functions
- Higher-order functions
- Function composition
- Custom operator definition
- Defining and using closures
- Function currying
- Recursion
- Memoization
推薦閱讀
- 同步:秩序如何從混沌中涌現
- 程序員修煉之道:從小工到專家
- Microsoft SQL Server企業級平臺管理實踐
- MongoDB管理與開發精要
- Flutter Projects
- 科研統計思維與方法:SPSS實戰
- 區塊鏈技術應用與實踐案例
- 區域云計算和大數據產業發展:浙江樣板
- SIEMENS數控技術應用工程師:SINUMERIK 840D-810D數控系統功能應用與維修調整教程
- Access數據庫開發從入門到精通
- 大數據數學基礎(R語言描述)
- AndEngine for Android Game Development Cookbook
- 數據中臺實戰:手把手教你搭建數據中臺
- 一本書讀懂大數據
- Python金融數據挖掘與分析實戰