Fork me on GitHub
#rewrite-clj
<
2019-06-02
>
sogaiu01:06:06

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

sogaiu01:06:33

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

sogaiu01:06:55

so your most recent code example was enlightening.

sogaiu01:06:47

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.

sogaiu01:06:12

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

sogaiu01:06:14

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?

sogaiu01:06:57

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

sogaiu01:06:05

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.

lread03:06:47

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

sogaiu21:06:28

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

lread21:06:11

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

lread21:06:43

but yes - absolutely am always open to your help!

lread21:06:12

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