Summary
In this chapter, we have looked at two distinct ways of composing our functional code. The first way is by chaining methods in a familiar dot notation-style chaining. This is a way of connecting inputs and outputs of various functions without having an intermediate variable assignment in between. While most programmers are familiar with this style of programming, there is some overhead required when writing (pure) functional code with generics in Go.
Another trade-off that we discussed here is the eager versus lazy modes of function evaluation. While it is possible to mimic lazy evaluation in Go, the compiler and language don’t do any of the heavy lifting for us. This means that if we were to port code from a functional language such as Haskell, the performance characters would be significantly different.
Finally, we also looked at continuations and CPS programming. A continuation is an abstract representation of any “next step” in an algorithm, whether...