This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-03
Channels
- # adventofcode (107)
- # announcements (1)
- # asami (14)
- # babashka (67)
- # beginners (89)
- # calva (34)
- # cider (17)
- # clj-kondo (5)
- # cljs-dev (2)
- # clojure (57)
- # clojure-europe (52)
- # clojure-india (1)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-nl (6)
- # clojure-uk (39)
- # clojurescript (40)
- # community-development (3)
- # conjure (3)
- # cursive (17)
- # datomic (11)
- # docker (13)
- # events (3)
- # figwheel-main (3)
- # fulcro (12)
- # graalvm (7)
- # holy-lambda (7)
- # honeysql (9)
- # introduce-yourself (5)
- # malli (9)
- # minecraft (3)
- # missionary (21)
- # nextjournal (7)
- # off-topic (52)
- # pathom (3)
- # polylith (11)
- # portal (3)
- # re-frame (21)
- # reagent (34)
- # reclojure (7)
- # reitit (1)
- # reveal (11)
- # shadow-cljs (68)
- # tools-build (12)
- # tools-deps (5)
- # vim (4)
- # xtdb (9)
What are the pros/cons of using deps.edn aliases and tools for doing infra and build type work vs babashka
One of the big questions I have is how easy will it be to run these build scripts 5 or 10+ years from now. Clojure has a very good track record for stability, but a lot of the clojure deps tools are still new and, in some cases, still alpha. For babashka, there's a lot of questions for how easy it would be to update or continue running the same script 5+ years from now.
For some projects, that's not really a concern, but I've recently been updating some 10+ year old projects so it's fresh on my mind.
Cons: startup time (JVM vs babashka). Pros: the CLI has a well-defined way to deal with any dependencies (whereas not all libraries work with bb
). Just off the top of my head. For us, at work, we're not too worried about JVM startup time, even for scripts in infra/ops stuff and we vendor the CLI scripts/JARs into our repo so we can deploy specific versions via the same machinery as everything else in our repo. We have no platform-specific code in our repo right now, which is always a bit of a concern for me with native binaries.
In any case it should be easy to port babashka scripts to Clojure since a main goal of it is to be compatible with JVM Clojure. So even if you run into limitations, you should be able to port with minimal effort.
Another point: babashka can be used to launch Clojure. In that sense it’s not a replacement but something that helps you keep track of the various things you can run in your project with its task runner. Some people use Make but you can do this with bb‘s task runner.
So to your question: it’s not deps.edn aliases vs bb: it can be both: https://book.babashka.org/#tasks
Everyone is different but personally I like the startup speed and ergonomics of bb tasks.
I have trouble remembering how to get a list of available tasks with tools.build but for bb it is bb tasks
which presents me with a tidy list of what I can do including brief help.
That said, I also do use tools.build, but I do use bb tasks as my front end. And of course, I also use deps.edn.
Yeah, use both. bb
task calls alias defined in deps.edn
which invokes build-clj
to do the uberjar creation. As others mentioned, I like the discovery/ease of bb tasks.
The main goal of babashka is to replace the scripts that one would normally write in bash or python. But it’s gotten pretty far in supporting existing Clojure libraries.
and of the aws libraries out there we are partial to https://github.com/cognitect-labs/aws-api
the reason i would lean toward clojure tools is mainly that i know stuff like this would work
@U3JH98J4R Babashka supports this API via https://github.com/babashka/pod-babashka-aws If startup time matters, then you could use that. If it doesn't matter, just use the JVM.
There is an in-progress port of this project to babashka from source here: https://github.com/grzm/yaaws-api/
and the short term benefit to that is i think 1. the commands get aliases 2. listable with bb tasks
The task runner can also be used to spawn multiple jobs at once. I've used this to set up my dev env: 1. One Clojure JVM app nREPL 2. One JVM process for building CLJS 3. One JVM process for building SASS
How can I take each entry of a row a group the columns? Like
[[a b c] [d e f]] => [[ad] [be] [cf]]
map can take multiple arguments. apply can be used to take the row apart Which function would you map over the entries to transpose them?
I'm not really sure how to use this. So as vector the input above is meant? So I end with map on every entry with this?
If you think about it like transposing a matrix (which it is), a matrix is a vector of vector, you want to create a vector of new vector where every element corresponds to a cross-section of the other vectors
So we want a function to take the nth element from every vector, meaning we have to (map ??? v1 v2 v3)
Since the vectors are in a vector, we need to use apply
(apply map ??? [v1 v2 ... vN])
Then, ???
will receive N elements, in order, and needs to return them in a vector
Which function does that? vector
Ah thanks
@UCFG3SDFV mentions MIDI in the README of binf but I'm not sure if it has built-in support
I worked a lot with MIDI from CLJC, yes 🙂 The Java API works but is a bit cumbersome. If platform doesn't matter, I recommend the WebMidi API in the browser because it's very minimalistic. You plug your input device, add a callback, and receive your MIDI events as raw Uint8Arrays. For parsing those binary MIDI message, I use https://github.com/helins/binf.cljc Actually, MIDI was one of the primary reasons behind writing this lib! It's CLJC + Babashka friendly. It implies knowing a bit the MIDI 1.0 protocol but it's really not that hard, especially since you often only need to deal with only a few type of events. Studying that will take you further than using the Java API which is more convenient at first but then shows its limits. I tried writing a MIDI lib but it's quite hard to come up with something that is truly generic given the wide variety of apps you might want to write. Just for fun, an animation written in Clojure I did some time ago: https://www.youtube.com/watch?v=XlEnrs0MDes
One small thing to note about Web MIDI API is that it's still experimental and not all modern browsers support it.
Yes, unfortunately only Chromium-based browsers support it. But the API has been kind of stable for a long time, probably because it is so minimalistic (and will most likely remain so).
Hello people.
Can someone tell me why this does not work in a lein
project?
(defn -main [& _]
(map println [1 2 3]))
lein run
Thanks !!!!!@mbrum there’s a #beginners channel that could probably walk you through this better
Cool, I will post there, but do you know why @dpsutton ??
Something included in Clojure, that’s what I meant :)
#([1 0] %)
vector can be used as a function from index to value. So just [1 0]
should work
Anybody aware of a proxy
that supports adding (Runtime) annotations to the generated class? Asking for a lost soul dealing with enterprises Java frameworks that uses a lot of these