官术网_书友最值得收藏!

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.
主站蜘蛛池模板: 隆安县| 晋城| 沈阳市| 什邡市| 民勤县| 双江| 顺义区| 嘉荫县| 青田县| 盘锦市| 红桥区| 新田县| 普兰县| 佛山市| 淮南市| 桑日县| 金阳县| 博兴县| 四子王旗| 加查县| 洞头县| 吐鲁番市| 舞钢市| 桃园县| 凤山县| 吉木乃县| 桓台县| 朝阳市| 泗水县| 浦县| 沧源| 汪清县| 威海市| 胶南市| 剑川县| 延长县| 乾安县| 台州市| 锡林郭勒盟| 乐陵市| 密山市|