Swift Functional Programming
by Dr. Fatih Nayebi
Print Length 页数: 316 pages
Publisher finelybook 出版社: Packt Publishing; 2nd Revised edition edition (27 April 2017)
Language 语言: English
ISBN-10: 1787284506
ISBN-13: 9781787284500
B0718YYXV9
Bring the power of functional programming to Swift to develop clean,smart,scalable and reliable applications.
About This Book
Written for the latest version of Swift,this is a comprehensive guide that introduces iOS,Web and macOS developers to the all-new world of functional programming that has so far been alien to them
Get familiar with using functional programming alongside existing OOP techniques so you can get the best of both worlds and develop clean,robust,and scalable code
Develop a case study on example backend API with Swift and Vapor Framework and an iOS application with Functional Programming,Protocol-Oriented Programming,Functional Reactive Programming,and Object-Oriented Programming techniques
Who This Book Is For
Meant for a reader who knows object-oriented programming,has some experience with Objective-C/Swift programming languages and wants to further enhance his skills with functional programming techniques with Swift 3.x.
What You Will Learn
Understand what functional programming is and why it matters
Understand custom operators,function composition,currying,recursion,and memoization
Explore algebraic data types,pattern matching,generics,associated type protocols,and type erasure
Get acquainted with higher-kinded types and higher-order functions using practical examples
Get familiar with functional and non-functional ways to deal with optionals
Make use of functional data structures such as semigroup,monoid,binary search tree,linked list,stack,and lazy list
Understand the importance of immutability,copy constructors,and lenses
Develop a backend API with Vapor
Create an iOS app by combining FP,OOP,FRP,and POP paradigms
In Detail
Swift is a multi-paradigm programming language enabling you to tackle different problems in various ways. Understanding each paradigm and knowing when and how to utilize and combine them can lead to a better code base. Functional programming (FP) is an important paradigm that empowers us with declarative development and makes applications more suitable for testing,as well as performant and elegant. This book aims to simplify the FP paradigms,making them easily understandable and usable,by showing you how to solve many of your day-to-day development problems using Swift FP.
It starts with the basics of FP,and you will go through all the core concepts of Swift and the building blocks of FP. You will also go through important aspects,such as function composition and currying,custom operator definition,monads,functors,applicative functors,memoization,lenses,algebraic data types,type erasure,functional data structures,functional reactive programming (FRP),and protocol-oriented programming(POP). You will then learn to combine those techniques to develop a fully functional iOS application from scratch
Style and approach
An easy-to-follow guide that is full of hands-on coding examples of real-world applications. Each topic is explained sequentially and placed in context,and for the more inquisitive,there are more details of the concepts used. It introduces the Swift language basics and functional programming techniques in simple,non-mathematical vocabulary with examples in Swift.
Contents
Chapter 1. Questions
Chapter 2. Getting Started with Functional Programming in Swift
Chapter 3. The Swift programming language
Chapter 4. Summary
Chapter 5. First-class functions
Chapter 6. Higher-order functions
Chapter 7. Function composition
Chapter 8. Closures
Chapter 9. Function currying
Chapter 10. Recursion
Chapter 11. Memoization
Chapter 12. Summary
将功能编程的功能带给Swift,开发清洁,智能,可扩展和可靠的应用程序。
关于这本书
撰写最新版本的Swift,这是一个全面的指南,将iOS,Web和macOS开发人员引入到迄今为止与其陌生的功能编程的全新世界
熟悉使用功能编程与现有的OOP技术,以便您可以获得两个世界的最好的,并开发干净,健壮和可扩展的代码
使用Swift和Vapor Framework开发示例后端API的案例研究,以及具有功能编程,面向协议的编程,功能反应编程和面向对象编程技术的iOS应用程序
这本书是谁
对于懂面向对象编程的读者来说,有一些Objective-C / Swift编程语言的经验,并希望通过Swift 3.x的功能编程技术进一步提高自己的技能。
你会学到什么
了解什么是功能编程,为什么它很重要
了解自定义运算符,函数组合,currying,recursion和memoization
探索代数数据类型,模式匹配,泛型,关联类型协议和类型擦除
使用实际的例子了解更高级的类型和高阶函数
熟悉功能和非功能的方式来处理可选项
利用诸如半群,单样,二叉搜索树,链表,堆栈和延迟列表等功能数据结构
了解不变的重要性,复制构造器和镜头
用Vapor开发后端API
通过组合FP,OOP,FRP和POP范例来创建iOS应用程序
详细
Swift是一个多范式的编程语言,可以让您以各种方式解决不同的问题。了解每种模式,了解何时以及如何利用和组合它们可以导致更好的代码库。功能编程(FP)是赋予我们声明性开发的重要范例,使应用程序更适合测试以及性能和优雅。本书旨在通过向您展示如何使用Swift FP解决许多日常开发问题,从而简化FP范例,使其易于理解和使用。
它以FP的基础开始,您将了解Swift的所有核心概念和FP的构建块。您还将通过重要的方面,例如功能组合和currying,自定义操作符定义,monads,函子,应用函子,记忆,镜头,代数数据类型,类型擦除,功能数据结构,功能反应规划(FRP)和协议(POP)。然后,您将学习结合这些技术从头开发功能齐全的iOS应用程序
风格和方法
一个易于遵循的指南,充满了现实世界应用程序的动手编码示例。每个主题按照顺序解释并放置在上下文中,更令人好奇的是,有更多的使用概念的细节。它以Swift中的示例介绍了Swift语言基础和功能编程技术在简单的非数学词汇中。
目录
问题
第2章Swift中的功能编程入门
第3章Swift编程语言
第四章总结
一等功能
第六章高阶函数
功能组成
第八章关闭
功能调理
第10章递归
第十一章记忆
第十二章总结
Swift Functional Programming,2nd Edition
相关推荐
- An Introduction to Data Analysis Using IBM SPSS
- Integration of Cloud Computing and IoT: Trends, Case Studies and Applications
- Ultimate Microsoft Power Automate Desktop: Leverage Microsoft’s Robotic Process Automation Capabilities to Automate Routine Tasks for Enhanced Efficiency and Productivity
- Emerging Threats and Countermeasures in Cybersecurity
- Machine Learning in Multimedia: Unlocking the Power of Visual and Auditory Intelligence
- Signal Processing for Joint Radar Communications