|
|
|
|
|
by skybrian
3960 days ago
|
|
Okay as far as it goes but it downplays some difficulties. A con when updating tree structures is the need to replace all nodes along the path from the root, which is why functional languages sometimes use fancy data structures like lenses. Graphs are a bit awkwardly represented (can't use regular pointers due to cycles). Reference comparisons are fast for small nodes, but for something like a large list, it's often not enough to know it was touched. You need to compute the diff to make updates efficient, which often requires a linear scan or worse. Making this efficient for arbitrary list mutations is a fairly difficult problem. |
|
I think you mean zippers. I'm not sure if lenses can be called data structures. They are closer to Functors than say Linked Lists in nature (but I may be wrong here).