- Functional Python Programming
- Steven F. Lott
- 231字
- 2021-08-27 19:20:23
Learning some advanced concepts
We will set some more advanced concepts aside for consideration in later chapters. These concepts are part of the implementation of a purely functional language. Since Python isn't purely functional, our hybrid approach won't require deep consideration of these topics.
We will identify these up front for the benefit of folks who already know a functional language such as Haskell and are learning Python. The underlying concerns are present in all programming languages but we'll tackle them differently in Python. In many cases, we can and will drop into imperative programming rather than use a strictly functional approach.
The topics are as follows:
- Referential transparency: When looking at lazy evaluation and the various kinds of optimizations that are possible in a compiled language, the idea of multiple routes to the same object is important. In Python, this isn't as important because there aren't any relevant compile-time optimizations.
- Currying: The type systems will employ currying to reduce multiple-argument functions to single-argument functions. We'll look at currying in some depth in Chapter 11, Decorator Design Techniques.
- Monads: These are purely functional constructs that allow us to structure a sequential pipeline of processing in a flexible way. In some cases, we'll resort to imperative Python to achieve the same end. We'll also leverage the elegant PyMonad library for this. We'll defer this until Chapter 14, The PyMonad Library.
推薦閱讀
- 演進(jìn)式架構(gòu)(原書第2版)
- 自然語言處理實(shí)戰(zhàn):預(yù)訓(xùn)練模型應(yīng)用及其產(chǎn)品化
- Learn Swift by Building Applications
- Java程序設(shè)計與實(shí)踐教程(第2版)
- HTML5+CSS3網(wǎng)站設(shè)計基礎(chǔ)教程
- Python完全自學(xué)教程
- 深度學(xué)習(xí):Java語言實(shí)現(xiàn)
- Mastering Unity 2D Game Development(Second Edition)
- Spring Boot+MVC實(shí)戰(zhàn)指南
- JSP程序設(shè)計實(shí)例教程(第2版)
- App Inventor少兒趣味編程動手做
- C++ System Programming Cookbook
- Java自然語言處理(原書第2版)
- Design Patterns and Best Practices in Java
- WCF全面解析