Back
Lex Sheehan: Learning Functional Programming in Go: Change the way you approach your applications using functional programming in Go (2017, Packt Publishing) No rating

"Learning Functional Programming in Go" Chapter 2 "Manipulating Collections" mini-review: chapter 2 weighs in at 40 pp, and is nominally about manipulating collections using standard functional tools such as Map and Reduce. Before it can, however, it has to lay some groundwork. It begins by defining functional terms like intermediate- and terminal-functors. One of the things I'm hoping to get from this book is a command of functional terms and concepts, and the book spends a lot of time ensuring that you understand the functional principles in those terms.

Unfortunately, we run into one of the core issues with the subject matter, which is that Go doesn't support two of the three elements that the author cites as foundational for FP; tail-call optimization and generics (the third being itertools-style map/reduce). Well, generics are now part of the language, and fortunately he does discuss what generic solutions might look like, so that leaves TCO.

Unfortunately again, however, the author states that TCO is perhaps the most important of the three. It's admirable that the author takes the time to illustrate how TCO works with Haskell instead. This necessarily adds a lot of mental overhead for a Go book, but the author is committed.

The chapter continues with coverage of itertools-like libraries, then a bit about the library favored by the author, Gleam. This is fairly standard stuff for beginner FP, but the author adds an informed opinion about the state of FP-oriented libraries and the performance considerations of different approaches, such as reflection.

Lots to cover in chapter 2, but I didn't come away feeling I had a grasp on anything I'm ready to put into production code yet.

One other note is that this book is showing its age not only in the discussion of generics, but also in that the author had to put in a note about Gleam having majorly changed its approach from LuaJIT.