Pure functions are memoizable
Memoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again.
Benefits of pure functions:
-They're easier to reason about
-They're easier to combine
-They're easier to test
-They're easier to debug.
-They're easier to parallelize
Other benefits:
-They're idempotent
-They offer referential transparency
-They are memoizable
-They can be lazy.
"The IO monad does not make a function pure. It just makes it obvious that it's impure".
Pure function signatures tell all.
When a function is pure its signature lets you make very strong guresses at what it does -even when you can't see the function name.
Top comments (0)