In this post, I ‘m going to introduce you some useful aspects of Cats library, mostly code snippets and I ‘m not going to delve into any theory or mathematics. Hopefully you will use them in your daily codes, resulting in much more simpler and readable code.
map using Functor You are already familiar with the prominent map method in Scala. Informally, a functor is any context with a map method.
Memoization is an optimization technique used to increase performance by storing the results of expensive function calls and returning the cached result when the same input occurs again. In this post I show how function memoization can be implemented in Go, in a pure functional manner.
Based on wikipedia definition, a function may be considered a pure function if both of the following statements about the function hold:
1. The function always evaluates the same result value given the same argument value(s).