Fork me on GitHub
#rewrite-clj
<
2022-04-04
>
olaf11:04:06

Crossposting from #clojure

borkdude11:04:19

@eliascotto94 What is the output you are getting?

olaf11:04:39

(defn foo [] 42)

borkdude11:04:12

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

🙌 1
borkdude11:04:14

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

borkdude11:04:41

so navigating to the root you must do first @eliascotto94

olaf11:04:08

Ohhh got it, thanks

olaf11:04:38

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

borkdude11:04:35

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

olaf11:04:48

Makes sense :thumbsup: :thumbsup: