rewrite-clj

Elia 2022-04-04T11:37:06.884289Z

Crossposting from #clojure

borkdude 2022-04-04T11:38:19.878039Z

@eliascotto94 What is the output you are getting?

Elia 2022-04-04T11:38:39.068829Z

(defn foo [] 42)

borkdude 2022-04-04T11:41:12.082939Z

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

🙌 1
borkdude 2022-04-04T11:42:14.866609Z

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

borkdude 2022-04-04T11:42:41.317999Z

so navigating to the root you must do first @eliascotto94

Elia 2022-04-04T11:43:08.613529Z

Ohhh got it, thanks

Elia 2022-04-04T11:43:38.918689Z

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

borkdude 2022-04-04T11:44:35.230139Z

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

Elia 2022-04-04T11:45:48.779239Z

Makes sense 👍 👍