|
|
|
|
|
by pka
207 days ago
|
|
> immutability in Clojure doesn't mean inefficiency. You are still doing a gazillion allocations compared to: for (let i = 0; i < data.length; i++) { hist[data[i]]++; }
But apart from that the mutable code in many cases is just much clearer compared to something like your fold above. Sometimes it's genuinely easier to assemble a data structure "as you go" instead of from the "bottom up" as in FP. |
|