clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Timofey Sitnikov 2020-12-10T12:41:01.219500Z

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 <http://localhost:8000>
shadow-cljs - server version: 2.11.8 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 9000
How do you start REPL to the nREPL on the port 9000?

thheller 2020-12-10T12:41:53.219700Z

you use your editor to connect?

Timofey Sitnikov 2020-12-10T13:10:29.220500Z

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

Timofey Sitnikov 2020-12-10T13:16:20.222100Z

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

borkdude 2020-12-10T13:31:35.222500Z

@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 Sitnikov 2020-12-10T13:40:14.225700Z

Thank you @borkdude, I did some more research on your recommendation, and it led me to: https://nrepl.org/nrepl/usage/clients.html#command-line-clients. I try to avoid using lein.

borkdude 2020-12-10T13:42:00.226500Z

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.

borkdude 2020-12-10T13:51:46.228400Z

@timofey.sitnikov

$ 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 Sitnikov 2020-12-10T13:57:44.230400Z

@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.

borkdude 2020-12-10T13:59:29.231300Z

@timofey.sitnikov the config project has a config for specifically that one: https://github.com/clj-kondo/config/blob/master/resources/clj-kondo.exports/clj-kondo/fulcro/config.edn There's work going on in #clj-kondo to come up with more advanced config to cover more of fulcro.

Timofey Sitnikov 2020-12-10T14:01:13.232Z

Perfect, thank you ...

joelv 2020-12-10T14:09:33.233500Z

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

thheller 2020-12-10T14:15:26.233700Z

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

fsd 2020-12-10T23:35:58.243700Z

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.

Example: 
cljs.user=&gt; (def isclicked (atom true))
#'cljs.user/isclicked
cljs.user=&gt; @isclicked
true
cljs.user=&gt; (swap! isclicked (not isclicked))
ERROR - db.call is not a function

dpsutton 2020-12-10T23:40:50.244100Z

(swap! is-clicked not)

dpsutton 2020-12-10T23:42:24.245600Z

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