3 ms·
You did not "totally misunderstand something": Immutability is a virtue in FP, you should write in this style. But it is only a "fundamental principle" and "cor
by jlg23 9y ago
You did not "totally misunderstand something": Immutability is a virtue in FP, you should write in this style. But it is only a "fundamental principle" and "core concept" in highly pure languages - and even Haskell allows mutable variables[1].
Sometimes you just need them, e.g. when handling potentially very large vectors in finite memory. CL's (sort ...) for example mutates the input sequence (or "destructively sorts" it [2]).
[1] https://wiki.haskell.org/Mutable_variable https://wiki.haskell.org/Mutable_variable
[2] http://www.lispworks.com/documentation/HyperSpec/Body/f_sort_.htm http://www.lispworks.com/documentation/HyperSpec/Body/f_sort...