This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-02
Channels
- # beginners (23)
- # calva (12)
- # cider (4)
- # clj-kondo (4)
- # cljsrn (2)
- # clojure (25)
- # clojure-chicago (1)
- # clojure-italy (6)
- # clojurescript (5)
- # datomic (5)
- # flambo (1)
- # fulcro (16)
- # hoplon (5)
- # joker (2)
- # keechma (45)
- # off-topic (2)
- # pedestal (2)
- # rewrite-clj (13)
- # robots (5)
- # shadow-cljs (62)
- # xtdb (12)
@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.
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 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.
@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 🙂