rewrite-clj

https://github.com/clj-commons/rewrite-clj
2019-06-02T01:36:06.039400Z

@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.

2019-06-02T01:37:33.040600Z

i don't see any warning about the return value of the function (argument passed to prewalk) affecting the traversal.

2019-06-02T01:37:55.041Z

so your most recent code example was enlightening.

2019-06-02T01:38:47.041900Z

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.

2019-06-02T01:40:12.042800Z

i found borkdude's code to be less surprising and straight-forward, thanks @borkdude.

2019-06-02T01:41:14.043800Z

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?

2019-06-02T01:41:57.044300Z

the docstring also doesn't explicitly state what the return value of prewalk should be / is.

2019-06-02T01:45:05.046500Z

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.

lread 2019-06-02T03:27:47.049Z

yeah, good points @sogaiu , I think the docs could use some love

2019-06-02T21:05:28.050600Z

@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 🙂

lread 2019-06-02T21:07:11.052400Z

what I should really do is finish my todos and release an alpha so that I can open the doors to collaboration.

lread 2019-06-02T21:07:43.053200Z

but yes - absolutely am always open to your help!

lread 2019-06-02T21:09:12.054600Z

yeah, cljdoc is a great and has a very welcoming and friendly community.