Fork me on GitHub
Timofey Sitnikov12:12:01

Good Morning Clojurians, If I start shadow-cljs like so:

p1~> npx shadow-cljs server
shadow-cljs - config: /home/sporty/clojure/fulcro/app1/shadow-cljs.edn
shadow-cljs - starting via "clojure"
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.11.8 running at 
shadow-cljs - nREPL server started on port 9000
How do you start REPL to the nREPL on the port 9000?


you use your editor to connect?

Timofey Sitnikov13:12:29

I do connect with the editor, but it does not give me just a REPL.

Timofey Sitnikov13:12:20

I use vim-iced, but I would like to have just a regular terminal REPL to quickly explore.


just use shadow-cljs node-repl or shadow-cljs browser-repl then


@timofey.sitnikov You can use lein repl :connect to connect to an nREPL server. I'm not sure if that works for ClojureScript, but why not, it's just nREPL after all?

Timofey Sitnikov13:12:14

Thank you @borkdude, I did some more research on your recommendation, and it led me to: I try to avoid using lein.


Well, you don't have to use lein as a dep manager, but it works just fine as an nREPL client. it has REPL-y built in. Up to you. Good luck.



$ clojure -Sdeps '{:deps {reply/reply {:mvn/version "0.4.4"}}}' -M -m reply.main --attach localhost:43851
seems to work fine for my current JVM nREPL :)

Timofey Sitnikov13:12:44

@borkdude, one more question for you, what is the best place to read how to resolve the fulcro defsc Unresolved Symbol error by clj-kondo? I followed the setup instructions, created the .clj-kondo and ran linting on the namespace to create the cache but still get that error.


@timofey.sitnikov the config project has a config for specifically that one: There's work going on in #clj-kondo to come up with more advanced config to cover more of fulcro.

Timofey Sitnikov14:12:13

Perfect, thank you ...


Having issues with doing advanced compilation with trying wrap an npm dependency with webpack bundler.

Bundling command failed
[webpack-cli] Compilation finished
assets by status 1.16 MiB [cached] 1 asset
runtime modules 889 bytes 4 modules
cacheable modules 1.18 MiB
  ./target/public/cljs/dev/main.js 1.08 MiB [built] [code generated]
  ./node_modules/@auth0/auth0-spa-js/dist/auth0-spa-js.production.esm.js 101 KiB [built] [code generated]

ERROR in ./target/public/cljs/dev/main.js 57:95-111
Module not found: Error: Can't resolve 'react' in '/Users/jvillahermosa/code/clj/self-service-ui/target/public/cljs/dev'

ERROR in ./target/public/cljs/dev/main.js 983:791-831
Module not found: Error: Can't resolve 'xmlhttprequest' in '/Users/jvillahermosa/code/clj/self-service-ui/target/public/cljs/dev'

webpack 5.9.0 compiled with 2 errors in 12628 ms


Hello Everyone, I am new to Clojure (I am js Dev), this question might sound silly. I want to change the value of a boolean variable to the opposite of its value. For example, if the value of a variable is true I want to change to false, vice versa. Since the only way to change the variable value is to use the atom and that’s what I used. I don’t know why I am getting this error.

cljs.user=> (def isclicked (atom true))
cljs.user=> @isclicked
cljs.user=> (swap! isclicked (not isclicked))
ERROR - is not a function


(swap! is-clicked not)


@U11BV7MTK thanks for your reply Ah I see, in Javascript I can just

let isclicked = false
isclicked = !isclicked
isclicked = !isclicked
Is there anyway I can change the value of a boolean variable to the opposite of its value like how I did it in JavaScript?


yes. in your example you can do (swap! isclicked not)


user=> (def clicked? (atom false))
user=> (swap! clicked? not)
user=> @clicked?


if you just want to set the value of an atom irrespective of its current value then (reset! clicked? true) or (reset! clicked? (not @clicked?)) . note this one where you are setting its value based on the current value of the atom is precisely what (swap! clicked? not) is doing except its changing it atomically without race conditions


ohhhhh that makes sense, thanks so much @U11BV7MTK time and help


swap takes an atom and a function to run on the value. (not isclicked) would return false as isclicked is an atom and therefore truthy (not false or nil) and negating that returns false. (swap! isclicked false) will call false with the argument of true (the current value of the isclicked atom) and blow up