rewrite-clj 2022-04-04

Crossposting from #clojure

@eliascotto94 What is the output you are getting?

(defn foo [] 42)

user=> (-> (z/of-string "(foo)") (z/insert-right 2) z/root str)
"(foo) 2"

🙌 1

calling z/sexpr on a zloc gives the sexpr at the current position

so navigating to the root you must do first @eliascotto94

Ohhh got it, thanks

But why if I do z/up instead, it wraps everything in a (do …)?

because you cannot have multiple s-expressions as 1 s-expression without wrapping it in something

Makes sense 👍 👍