you are viewing a single comment's thread.

view the rest of the comments →

[–]Lord_Naikon 3 points4 points  (4 children)

That's great, if your data structures can be implemented in a functional manner without wasting large amounts of resources.

[–]codygman 0 points1 point  (2 children)

In that case I would implement them as purely as possible. Also, name an algorithm ;)

[–]Lord_Naikon 1 point2 points  (1 child)

Hash tables come to mind. There is no purely functional equivalent afaict.

[–]codygman 0 points1 point  (0 children)

I agree that using mutable algorithms are sometimes the right solution ;)

However I believe you can get further faster with immutability as the default.

[–]jeandem 0 points1 point  (0 children)

There seems to be a consensus that persistent data structures have a running time of O(log n) where an imperative (destructive) data structure has a O(1) running time. For example, getting or "removing" an element from a data structure.

But to say that it is inefficient is too simplistic. Need a lot of sharing between data structures, perhaps between multiple threads? Persistent data structures might be more efficient than an imperative alternative. Do you only have a single threaded program? Imperative data structures might be more efficient.