Oh, interesting, I implemented a zipper in Elixir and came across gap buffers as a result while reading afterwards, but never implemented one/didn’t realize the normal implementation involved mutation… I was actually considering making a zipper protocol/library or something that abstracted the differences between (in my mind) a zipper-tree, a zipper-array or gap buffer, and maybe a zipper-map (which I’m a little fuzzier on utility/implementation of, but I guess for ordered/each traveral of k/v pairs with pausable/passable state etc).
I’d imagined the functional version of gap buffer as just a pair of lists each with the head of the list at the gap, and moving the gap just being an O(1) add/remove mutation on each list, but maybe I’m missing/forgetting something?






















