Design patterns·Functional ideas that went mainstream
you called it twice with the same arguments, got the same answer, and nothing anywhere else changed.
Pure function
Also calledpurity, pure
A function whose result depends only on its arguments and which changes nothing outside itself. Purity is what makes a function trivially testable, safely cacheable, freely reorderable and safe to run on several threads — every one of those properties follows from the same two conditions. The design move it suggests is not writing everything this way but knowing which of your functions are, and being deliberate about where the impure ones live.