Take a look at clojure.walk source. This is a library for performing (bulk) operations in all Clojure nested data structures (excluding ordered maps). There is a very powerful, but deceptively simple kind of code, using recursion through locally defined anonymous functions, without using loop / recur.
Most of the functions there are based on the postwalk and prewalk functions, which in turn are based on the walk function. With the source text and the (prewalk-demo form) and (postwalk-demo form) form, you can get a good idea of the recursive steps.
I do not know if this will help you in solving your problem. I'm currently trying to do something in the same problem area: create a function to “smooth out” nested maps and vectors into a sequence of all paths from root to leaf, each path is a sequence of keys and / or indices ending in a “leaf”.
This library seems to make editing values recursively throughout the structure quite simple. However, I still do not know how to use it to functionally track accumulated data between iterations, which are necessary for my “paths” and probably also for your “skeleton” problem.
source share