Summary
In this chapter, we looked at libraries that implement concepts of the functional programming paradigm. We started by looking at Pie, a library that can help users in building code in the functional paradigm whether working with a code base that uses Go before or after the introduction of generics in Go 1.18. Specifically for the pre-generics version, we looked at the approach of code generation for custom types to get generics-like behavior. Pie allowed us to showcase the ease with which we can create functions such as Map and Filter since the introduction of generics.
Then, looked at the Lodash-inspired Go library, lo
. This library supports common functions that operate on container data types such as slices and maps, but unlike Pie, it follows a nested approach to function chaining rather than the dot notation syntax. lo
does offer concurrent implementations for certain functions, so if performance is a concern and concurrency seems like the right solution, checking out...