4 ms·
Some solutions are easier to express recursively than iteratively--especially in the graph/tree space. Filesystem? Tree. XML/JSON? Tree. Relational databas
by jstewartmobile 7y ago
Some solutions are easier to express recursively than iteratively--especially in the graph/tree space. Filesystem? Tree. XML/JSON? Tree. Relational database? Graph w/ underlying tree implementation. State machine? Graph.
As for immutability, consider how in languages like javascript, some mental accounting has to take place over what is passed by reference, and what is passed by value. Any error in this accounting can cause big problems. A pure-functional approach really cuts that problem down to size. New values are returned, and parameters are unchanged.