Fork me on GitHub

are the z/right* , z/left* etc.. functions available in cljs? they work great in the clojure repl, but when i switch to a cljs repl ( browser) i get an error saying they are undefined.


it works if i access the function directly like so

(-> zloc


Hi @U9VP9VCE6, thanks for reaching out with your question. I’ll try to reproduce your issue. I’m running on macOS, so any shell commands will be in bash. I’ll start with creating, then switching to an empty new directory from bash:

mkdir testing123 
cd testing123
Now I’ll create a minimal deps.edn file in the testing123 directory that references the current versions of ClojureScript and rewrite-clj. It has the following content:
{:deps {org.clojure/clojurescript {:mvn/version "1.10.866"}
        rewrite-clj/rewrite-clj {:mvn/version "1.0.682-alpha"}}}
From bash, I’ll launch a ClojureScript REPL like so:
clj -M --main cljs.main --repl
This launches a web browser and gives me a REPL to that browser at the terminal:
ClojureScript 1.10.866
Now I’ll poke around in the REPL. First I’ll start with requiring the API:
cljs.user=> (require '[ :as z])
That looks good. Now I’ll do a little sanity test with down*:
cljs.user=> (-> "[1 2 3]" z/of-string z/down* z/string)
That seems good. Ok, let’s navigate to the space node after 1:
cljs.user=> (-> "[1 2 3]" z/of-string z/down* z/right* z/string)
" "
That also seems good to me. You also mentioned left* so I’ll try that too by navigating to 3 and then back to 2:
cljs.user=> (-> "[1 2 3]" z/of-string z/down* z/rightmost* z/left* z/left* z/string)
Looks good over here. So I think there must be something different on your side. I look forward to learning more. Just a wild guess, but are you maybe still including rewrite-cljs as one of your dependencies? If so, remove it; rewrite-clj v1 replaces rewrite-cljs and rewrite-clj v0.


thanks for the very detailed reply. yeah, i removed rewrite-cljs but i still the same issue. i ll keep looking into it, i must be doing something very silly somewhere… :) btw, thanks for the work on the library!!1


@U9VP9VCE6, if you find yourself still stuck, come back and share more of your setup/environment and we’ll figure it out. Sometimes some other library will bring in an unexpected dependency. If you are using leiningen, you could try lein deps :tree, if you are using tools cli, you could try clj -Stree.


thanks, that’s actually what i am exploring now. cleared .m2 of rewrite-clj and rewrite-cljs but on recompiling ( i am using shadow ) rewrite-cljs gets pulled back in. i have to go now, but i will look at it in detail when i am back and report

👍 1

back now. cleared ./shadow-cljs , removed a zprint dependency i am not using and re-installed the library. all working now :) many thanks @UE21H2HHD ! apologies for the noise.


Sweet! No need to apologize, I’m sure this discussion will help others who stumble into a similar situation.


👏 👏 🙌