This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-08
Channels
- # announcements (20)
- # aws (16)
- # babashka (63)
- # beginners (75)
- # calva (35)
- # cider (2)
- # clj-commons (5)
- # clj-kondo (2)
- # cljs-dev (1)
- # clojure (90)
- # clojure-australia (3)
- # clojure-europe (16)
- # clojure-france (1)
- # clojure-nl (4)
- # clojure-uk (5)
- # clojurescript (7)
- # data-science (2)
- # datahike (1)
- # datomic (39)
- # emacs (31)
- # events (2)
- # figwheel-main (1)
- # fulcro (15)
- # gratitude (8)
- # helix (17)
- # holy-lambda (1)
- # introduce-yourself (1)
- # jobs (3)
- # kaocha (2)
- # liquid (1)
- # malli (1)
- # nrepl (2)
- # other-languages (1)
- # portal (76)
- # react (19)
- # reagent (9)
- # remote-jobs (1)
- # rewrite-clj (9)
- # shadow-cljs (31)
- # tools-deps (5)
- # xtdb (11)
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
rewrite-clj.custom-zipper.core/right
z/string)
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
cljs.user=>
Now I’ll poke around in the REPL.
First I’ll start with requiring the rewrite-clj.zip API:
cljs.user=> (require '[rewrite-clj.zip :as z])
nil
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)
"1"
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)
"2"
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
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.