Theseus and the Zipper
en.wikibooks.org
en.wikibooks.org
While I can understand why children would consider Spiderman a hero (teaches kids that special talents and roles imply more responsibilities; G-d bless Stan Lee)... I don't think any kid sees SpongeBob as a hero.
Unless you're making a follow-up joke and I'm just missing that.
In particular, if performance is a concern, I found it almost inevitable that I would reach for mutable options.
Would love to hear examples in the wild of this.
Might be useful for things that are often compared, like for instance the React virtual DOM.
The hash idea works even in mutable land. There are obvious caveats to not mutating data in race related scenarios. But often snapshots and other "freeze" based ideas are just as workable as moving entirely to alternatives.
Uh, how? Other than removing it from the dictionary, mutating it then adding it back.
I fully grant that immutable structures take away the concerns over data being coherent together. Such that it's easy to do without worrying about someone changing the data under you.
Oddly, it can sometimes make it even harder to know that data is stale. Since updating a small part can devolve into a chore. Still fully agreed that that is the best default position.
https://www.cs.tufts.edu/~nr/pubs/zipcfg.pdf
In section 5 they say their zipper turned out to be a little bit faster than the imperative version (they use Ocaml). And the resulting code is simpler and less buggy than the imperative one (section 6.3).
I confess I'm always wary of reimplementations and claims of improvement. Still, this is exactly what I asked for, thanks! I'm looking forward to finding where I'm wrong.
DSW’s algorithm is used in the mark phase of garbage collection. It traverses and marks all reachable data in constant space.
https://inst.eecs.berkeley.edu/~cs61bl/r//cur/graphs/garbage...
Does remind me of threaded trees. Stackless traversal is a fun topic.