@lee thanks for the investigation -- looking at prewalk's documentation string, i see:
> Perform a depth-first pre-order traversal starting at the given zipper location
> and apply the given function to each child node. If a predicate p?
is given,
> only apply the function to nodes matching it.
i don't see any warning about the return value of the function (argument passed to prewalk) affecting the traversal.
so your most recent code example was enlightening.
if the function argument returns some other location, it's possible the walk is not strictly a depth-first traversal any more i guess -- at least not a complete one.
i found borkdude's code to be less surprising and straight-forward, thanks @borkdude.
i incorrectly assumed that the function argument return value would be used in place of the original -- though the doc string does not imply such a thing -- it was surprising to learn that the traversal could be affected, though perhaps for this sort of thing, may be that should be expected?
the docstring also doesn't explicitly state what the return value of prewalk should be / is.
by studying its implementation and examining subedit-node, replace (from zip/editz), and replace (from custom-zipper.core), one can learn more about what might be returned, but this (though helpful in learning parts of rewrite-clj) seems like more work than should be necessary to just learn how to use prewalk.
yeah, good points @sogaiu , I think the docs could use some love
@lee if i come up with potential improvements to the docs, may be we can discuss them? btw, thanks for mentioning cljdoc in the past, i'm taking a closer look now 🙂
what I should really do is finish my todos and release an alpha so that I can open the doors to collaboration.
but yes - absolutely am always open to your help!
yeah, cljdoc is a great and has a very welcoming and friendly community.