Fork me on GitHub

anyone did some pipeline in Azure devops for Clojure?


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:


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


the biggest library requiring thing we would need would be to do aws automation


and of the aws libraries out there we are partial to


the reason i would lean toward clojure tools is mainly that i know stuff like this would work


@U3JH98J4R Babashka supports this API via 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:


and regardless i could use babashka as a more general frontend to this stuff


bb some:task -> clj -T build create-aws-thing :arg arg


yes, indeed


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


And then all I need to have them all three is: bb dev

😎 1

@fabrao We have a bunch of ADO pipelines at work


How can I take each entry of a row a group the columns? Like

[[a b c] [d e f]] => [[ad] [be] [cf]]

Ben Sless08:12:28

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?

Ben Sless08:12:21

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


Are you doing Advent of Code? ;)


Yes. And I use babashka for it.

🎉 1

(partial apply map vector)


what library would you use to parse the incoming midi stream from an electric piano?


@UCFG3SDFV mentions MIDI in the README of binf but I'm not sure if it has built-in support

Adam Helins15:12:08

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 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:

👍 4

One small thing to note about Web MIDI API is that it's still experimental and not all modern browsers support it.


web midi also works with Node and it could possibly be used from #nbb :)

Adam Helins15:12:39

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


thanks for all the answers! ☺️


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 ??


i sure do. and i’ll tell you in #beginners

😄 6

Is there a quick function that does if 0 then 1 else 0 ?

🎄 3
Ben Sless18:12:07

#(- 1 %)

👏 4

Basically swapping 0 for 1


and viceversa


define "quick function"


Something included in Clojure, that’s what I meant :)


(fn [arg] (if (zero? arg) 1 0)) (get {0 1} arg 0)


#(bit-xor % 1)

👍 2
☝️ 1
replied to a thread:define "quick function"

Something included in Clojure, that’s what I meant :)


({1 0 0 1} 1) => 0
({1 0 0 1} 0) => 1


#([1 0] %) vector can be used as a function from index to value. So just [1 0] should work


#(mod (inc %) 2)


#(* -1 (dec %))

Jelle Licht23:12:57

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