- 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
推薦閱讀
- 數(shù)據(jù)要素安全流通
- 數(shù)據(jù)庫基礎與應用:Access 2010
- Test-Driven Development with Mockito
- 大數(shù)據(jù)可視化
- 大數(shù)據(jù)導論
- MySQL從入門到精通(第3版)
- 數(shù)據(jù)庫程序員面試筆試真題庫
- 深入理解InfluxDB:時序數(shù)據(jù)庫詳解與實踐
- 二進制分析實戰(zhàn)
- Python數(shù)據(jù)分析從小白到專家
- 大數(shù)據(jù)技術原理與應用:概念、存儲、處理、分析與應用
- Spring MVC Beginner’s Guide
- Gideros Mobile Game Development
- 標簽類目體系:面向業(yè)務的數(shù)據(jù)資產設計方法論
- 大數(shù)據(jù)隱私保護技術與治理機制研究