This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-06
Channels
- # aleph (1)
- # announcements (29)
- # babashka (39)
- # beginners (52)
- # cider (3)
- # cljsrn (19)
- # clojure (167)
- # clojure-europe (15)
- # clojure-nl (2)
- # clojure-uk (62)
- # clojurescript (13)
- # community-development (8)
- # cursive (5)
- # datomic (10)
- # introduce-yourself (1)
- # java (10)
- # jobs (12)
- # jobs-discuss (1)
- # kaocha (2)
- # lsp (6)
- # luminus (1)
- # malli (15)
- # meander (3)
- # music (1)
- # nrepl (2)
- # off-topic (91)
- # pathom (4)
- # reagent (21)
- # reitit (10)
- # sci (5)
- # shadow-cljs (17)
- # spacemacs (3)
- # sql (7)
- # tools-deps (40)
- # utah-clojurians (2)
- # xtdb (7)
Does scittle support #js literals? It seems to me that #js {:x 1} is not the same as (clj->js {:x 1})
@UJ1339K2B Do you mean that:
user=> #js {:x 1}
#js {:x 1}
user=> (clj->js {:x 1})
#js {:x 1}
user=> (= #js {:x 1} (clj->js {:x 1}))
false
the last thing returns false?Hmm, actually I meant something different. I will try to provide a minimal repro for it :D
If you mean "nested" objects, that is a known difference. Maybe first try in "real" CLJS, to see if it's different from SCI
Correct. bb supports reader conditionals too with its own being :bb
Also if we really wanna be detailed, files having a shebang #!/usr/bin/env bb
regardless of the extension may be considered bb files too? 😄
I think anyone putting bb
code in .cljs
(or .perl
) files will not have a good time in Cursive 🙂
true that! 😆
Hi! I'm using babashka on Windows PowerShell, and I'm trying to run a script that goes into all the subdirectories of my current folder and extracts some data from a file called out
that is in each of those subdirectories. This script gives proper output on MacOS (a vector with various non-zero values), but on Windows I'm running into a problem where the script runs, but it doesn't seem to access any of the files that I need it to access because it returns an empty vector. This is the function that reads the files and dumps all the needed data into a single vector:
(defn all-log-vecs []
"Assumes log files are in subdirectories and all named 'out'."
(map #(read-string (str "[" (slurp %) "]"))
(map str (fs/glob "." "*/out"))))
Is there an issue with the arguments inside fs/glob that explains why this isn't working on Windows?
@klliu23 Hello Karen, welcome. I think glob works a bit differently on Windows unfortunately. Let me look it up for you
take a look at these docs here: https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String) I think those will explain what you should do on Windows
It beats me why they made the syntax different on Windows, but I decided to not mess with this in bb and just expose the Java stuff directly
i wish there was a syntax like (chdir "x" (...))
for bb tasks, but it sounds like doing that in java is dubious, which is probably why it doesn't already exist in clojure 😕
i found this as an example: https://github.com/arohner/lein-daemon/blob/master/daemon-runtime/src/leiningen/daemon/runtime.clj#L11
Technically it's possible, but not without caveats.
Note that clojure
and shell
already support :dir
in tasks
So if you're using it with that, for now use a binary from #babashka-circleci-builds
yeah, i was looking for a nice "do everything" syntax (automatically setting the dir for shell and fs)
the difference would be something like this:
(let [js (str (fs/path "target" "lambda" "lambda.js"))
zip (str js ".zip")]
(shell {:dir proj} "...")
(fs/delete-if-exists (fs/path proj zip))
(shell {:dir proj} "..."))
(let [js (str (fs/path "target" "lambda" "lambda.js"))
zip (str js ".zip")]
(chdir proj
(shell "...")
(fs/delete-if-exists zip)
(shell "....")))
so, nothing that can't be worked around, just thought it would be a really nice syntax
yeah, I think raynes/fs had a *dir*
dynamic var, but that only works for that namespace. I think if tasks would introduce such a var, I would have to curate every library inside bb to see if it makes sense to respect that var or not and users would also have to guess if bb did this :)