Swift函数式编程:第二版

需积分: 10 15 下载量 191 浏览量 更新于2024-07-19 1 收藏 2.46MB PDF 举报
“Packt.Swift.Functional.Programming.2nd.Edition.2017”是一本针对Swift 3.x的全面指南,旨在帮助已有Objective-C/Swift编程基础的iOS、Web和macOS开发者了解并掌握功能编程的世界。书中通过实例介绍如何将函数式编程与面向对象编程(OOP)结合,以编写出更干净、强大且可扩展的代码。书中的案例研究包括使用Swift和Vapor框架构建后端API,以及结合FP、OOP、函数响应式编程(FRP)和协议导向编程(POP)构建iOS应用。 本书适合熟悉面向对象编程,有一定Objective-C/Swift经验的读者,旨在提升其在Swift中运用函数式编程技巧的能力。 读者将学习到: 1. 理解函数式编程的概念及其重要性,了解它如何改善代码结构。 2. 掌握自定义运算符、函数组合、柯里化、递归和记忆化等核心概念。 3. 探索代数数据类型、模式匹配、泛型、关联类型协议和类型擦除。 4. 学习高阶类型和高阶函数,并通过实际例子进行实践。 5. 熟悉处理可选值的函数式和非函数式方法。 6. 使用如半群、幺半群、二叉搜索树、链表、栈和惰性列表等功能数据结构。 7. 明白不可变性、复制构造器和透镜在开发中的重要性。 8. 使用Vapor框架构建后端API。 9. 结合多种编程范式创建iOS应用。 本书采用易于理解的方式,通过实际编码示例讲解函数式编程在Swift中的应用。内容逐步展开,对于有深入探究需求的读者,书中还提供了更多概念的详细信息。全书包括从基础到高级的各个章节,如第一类函数、高阶函数、函数组合、闭包、柯里化、递归、记忆化等。 目录: - 第1章:引言 - 第2章:Swift中的函数式编程入门 - 第3章:Swift编程语言 - 第4章:概览 - 第5章:第一类函数 - 第6章:高阶函数 - 第7章:函数组合 - 第8章:闭包 - 第9章:函数柯里化 - 第10章:递归 - 第11章:记忆化 - 第12章:总结 此书采用实践导向的风格,用非数学语言解释Swift语言基础和函数式编程技术,通过丰富的Swift示例帮助读者轻松掌握这些概念。
2019-09-23 上传
Key Features Greatly improve your code quality, testability, and readability using modern functional programming techniques Get a solid foundation in functional programming techniques and methodologies Step-by-step learn the concepts to architect more robust code Book Description A functional approach encourages code reuse, greatly simplifies testing, and results in code that is concise and easy to understand. This book will demonstrate how PHP can also be used as a functional language, letting you learn about various function techniques to write maintainable and readable code. After a quick introduction to functional programming, we will dive right in with code examples so you can get the most of what you’ve just learned. We will go further with monads, memoization, and property-based testing. You will learn how to make use of modularity of function while writing functional PHP code. Through the tips and best practices in this book, you’ll be able to do more with less code and reduce bugs in your applications. Not only will you be able to boost your performance, but you will also find out how to eliminate common loop problems. By the end of the book, you will know a wide variety of new techniques that you can use on any new or legacy codebase. What you will learn Declare functions/callables and find out how to manipulate and call them Write pure functions to get more robust code that can be easily tested Learn to compose function using various techniques Use a functional approach to find readable solutions to common issues Utilize performance optimization techniques such as laziness, memorization, and parallelization Build the business logic of applications with the functional paradigm Test functional code and know how to speed up test runs using parallel testing Understand the impact and limitation of functional programming in PHP About the Author Gilles Crettenand is a passionate and enthusiastic software,解压密码 share.weimo.info