This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-13
Channels
- # announcements (1)
- # babashka (28)
- # beginners (49)
- # calva (34)
- # cider (8)
- # clj-kondo (7)
- # clojure (114)
- # clojure-austin (1)
- # clojure-denver (15)
- # clojure-europe (8)
- # clojure-norway (3)
- # clojurescript (83)
- # datahike (1)
- # datomic (5)
- # emacs (6)
- # events (1)
- # helix (11)
- # honeysql (2)
- # hyperfiddle (95)
- # jackdaw (1)
- # jobs-discuss (6)
- # kaocha (5)
- # lsp (15)
- # malli (3)
- # off-topic (171)
- # polylith (17)
- # re-frame (18)
- # releases (1)
- # ring (3)
- # sql (7)
1. The one that just does the stuff (build.sh) 2. The one that has an abstract notion of a "task graph"
and then within 2 there are spectrums of "is this tailored to a single language/platform" and "how much of the properties of the graph is used to do caching, parallelism, etc"
The hypothesis is that, instead of representing the task graph in a regular language / DSL or in specialized configuration files - represent it visually
That sounds a bit, at the abstraction level, like what I understood the Boot build tool to be. Maybe someone just needs to write a UI on top of it.
So the idea is to make something similar, but which represents the "task graph" of a build tool explicitly
Doing stuff like making a Multi Release Jar is very hard with build tools like maven. Feels almost simple if the graph is drawn out and editable
I don't think a build tool for CLJ(s,*) is that interesting since for the most part it doesn't seem like we need them
http://www.lihaoyi.com/post/SowhatswrongwithSBT.html http://www.lihaoyi.com/post/BuildToolsasPureFunctionalPrograms.html
ever look at pathom? dependency resolution is easy work for a backward chaining logic engine, just model dependencies as attributes, and it comes with a UI pathom-viz that gets you 90% of the way there
@U797MAJ8M I'm unclear on how pathom relates?
> The hypothesis is that, instead of representing the task graph in a regular language / DSL or in specialized configuration files - represent it visually you can represent a task graph in clojure as pathom resolvers -- it is surprising how powerful this abstraction is -- and get much of the visual part for free... but reading it again I think you may just mean parsing some existing data outputted by some tool, and converting that to something a charting library like cytoscape would understand?
I don't expect you to watch the whole thing obv. but this is what i am imagining for the user experience
> you can represent a task graph in clojure as pathom resolvers -- it is surprising how powerful this abstraction is -- and get much of the visual part for free... The point isn't to have code that is introspect-able to make a graph, its to have users engage directly with the visual representation
I have a problem calling a value from another file in my entry file. Both files are in main folder. I found this in config, isn't there something else I need to do to be able to reference the other file?
=====
shadow-cljs
is configured by a shadow-cljs.edn
file in your project root directory. You can create a default one by running shadow-cljs init
. It should contain a map with some global configuration and a :builds
entry for all your builds.
{:source-paths [...]
:dependencies [...]
:builds {...}}
An example config could look like this:
{:dependencies
[[reagent "0.8.0-alpha2"]]
:source-paths
["src"]
:builds
{:app {:target :browser
:output-dir "public/js"
:asset-path "/js"
:modules {:main {:entries []}}}}}
The file structure for this example should look like this:
.
โโโ package.json
โโโ shadow-cljs.edn
โโโ src
โโโ my
โโโ app.cljs
=====
If I have (def one 1) in config.cljs, shouldn't I be able to reference it with my.config/one in app.cljs? What else is needed?
.
โโโ package.json
โโโ shadow-cljs.edn
โโโ src
โโโ my
โโโ app.cljs
โโโ config.cljs
Ok, will try that . It is strange because in a project I was referring, it is using the keyword :refer, but it only refer a value in the file yet other stuff is still available. I suppose I'll be able to understand that later
if you use a fully qualified name like my.app.config/one
then it will work if that ns has been loaded for some other reason in the app. but it's not good form to rely on that.
That's what I thought! Thanks
avoid using full qualified names such as my.config/one
in code directly though. you are much better off using alias references (e.g. :as
or :refer
)
Anyone noticed this curiosity with range
before?
In Clojure, passing a nil
as the first arg to range
throws NPE, but in ClojureScript it doesn't and odd things can happen:
(range nil 0)
=> ()
(range nil 1)
=> (nil)
(range nil 2)
=> (nil 1)
What's worse is if you have the start and the step both being nil:
(range 0 0 0)
=> ()
(range nil 0 nil)
INTERNAL REPL ERROR: Got an unexpected reply from relay, check Inspect
Timeout while waiting for result.
Evaluates to an infinite seq of nils!
(take 10 (range nil 0 nil))
=> (nil nil nil nil nil nil nil nil nil nil)
๐ฅworth me raising it as a problem
on http://ask.clojure.org do you think?
indeed. this is a little more dangerous because, at least in our case, the unexpected infinite sequence crashes the browser.
Hello fellow Clojurians! I'm looking to open REPL connection to #C6N245JGG :node-test
build, but when the tests complete, the runtime (node.js process) exists. Do you have recommendations on how to achieve it?
I've been looking through shadow-cljs code but haven't found a good way. Also tried couple tricks like listening STDIN, and js/setTimeout
(in tests and the runner) but no there either.
Or would the solution be to create normal :node-script
build with the same files (including test deps and sources) and bind to a port (similar to node.js server, just with test dependencies)?
For future reference, as you can see by the highlighted #C6N245JGG link, there's a channel for it so it's best to ask such questions there. But no need to move this message that's already been posted.
Sorry, I haven't used Slack for long time and thought hashtag was just to mark a topic, but it's a channel reference. Thanks for reminding!
:node-test
doesn't support a REPL since the entire point is running the tests and exiting with a non-zero exit code on failing tests
Great. Thanks! I'll try both! Shadow-cljs is awesome! If you have a way to donate Bitcoin via Lightning, I'd be happy to support the project
LN looks interesting but I haven't done anything with it yet, so only traditional github sponsors and so on for now ๐
If you happen to be on Nostr, I could send you Zaps (SATs via lightning https://nostr.how/en/zaps) (non-custodial). Or https://tippin.me/ is easy too with Twitter (custodial)
Yeah. I'm building some MVP-s of my ideas related to Bitcoin & Lightning using shadow-cljs. Loving it!
Why I can't assign % to value in let?
(-> (js/logseq.App.getAllPages)
(.then #(
do(
(let [pages %]
(println pages))
))))
When I remove the let part and just use println %, it works.
Error:
Syntax error macroexpanding cljs.core/let.
Call to cljs.core/let did not conform to spec.
Oh, wait, never mind. While it would also fail, it would result in a different error - an attempt to call null
.
Are you sure that error comes from that let
and not some other?
If yes, then there should be more details to that error that show exactly where the spec has failed.
The following gives an error at the let part but is able to println % properly:
(-> (js/logseq.App.getAllPages)
(.then #(
do(
(println %)
(let [pages %]
(println pages))))))
That should be a different error then - about calling null
since you have an extra ()
after do
- you're trying to call the result of (let ...)
.
The macroexpand error happens during compilation and is probably some earlier error that has nothing to do with the above.
Oh, you're right, the error is not related... it was a previous error
I get this error in the app console:
VM421:2 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'call')
at eval (eval at shadow$cljs$devtools$client$browser$global_eval
Try #(let [pages %] ...)
- you don't need do
.
And with do
it would be
#(do
(let [...] ...))
So the println called within let is in error
(println ...)
always returns nil
.
(let [...] (println ...))
also returns nil
then.
(do ...)
evaluates its body and returns the result of the last form.
(do (...))
(that you have) calls ...
as a function and returns its result.
In your case, that ...
is (let ...)
, so you're trying to call nil
as a function. Hence why I keep talking about extra ()
which turn a plain value into a function call.
I was wondering why clojure.core/future and promise are not translated/available into CLJS. Does anyone know what was the challenge or limitation? Thanks
js doesnโt have threads or blocking. So no way for a future to run concurrently and no way for a promise to receive a value and execution to continue
so in
(let [p (promise)]
(future (Thread/sleep 2000) (deliver p :hi))
@p)
this kicks off a thread that waits for 2 seconds
in the meantime, the current thread continues and dereferences p
. That has no value (yet) so it waits. After two seconds the other thread delivers the value :hi
to the promise, and the main thread gets its value and continuesReading this, it looks like core.match is still not compatible with the bootstrapped/cljs variant, is that correct? (https://clojure.atlassian.net/browse/MATCH-116)
There does seem to be abbinare, but it looks out of date: https://github.com/viebel/abbinare