Post by Martin McBride on Oct 1, 2019 12:27:04 GMT
ebook (PDF) covering functional programming in Python.
The book covers the basics of functional programming including function objects, immutability, recursion, iterables, comprehensions and generators. It also covers more advanced topics such as closures, memoization, partial functions, currying, functors and monads. No prior knowledge of functional programming is required, just a working knowledge of Python.
What is functional programming? Objects, variables, and functions as objects. Immutable objects. Recursion. Closures. Iterators. Transforming and reducing iterables. Comprehensions. Generators. Partial application and currying. Functors and monads. itertools, functools and other useful libraries.
I keep catching little typos. I move past them because the overall structure of the book is 90% of what I wanted, so thanks for that. I'm on chapter 5, but currently the most egregious issue was the missing example at the bottom of 3.5.1 and subsequently, the missing comma in the first code block in 3.5.1 which reads: `u = v[:n] + (3) + v[n:]` and should read: `u = v[:n] + (3,) + v[n:]`
I only caught this because I decided to try and write the missing example and then, since I'm not use to using tuples (new to Python), tried out both as functions and discovered the need for a single-element tuple to include the comma. I also learned, which was not noted here in slices (I have a lot of notes in the margins of this specific page), that while you lead-in to the section referring to them all as _sequences_, the slice example you gave very much requires type matching. You cannot `string[:n] + (tuple) + string[n:]`. Just seemed like a bit of a rush through this page.
Anyway, if I find any more major items, I'll let you know (if you want).