It's this really nice combination of bash, curl, and libraries for JSON, CSV, ZIP files, and almost everything else you could need. Full list at [0]. You can always spawn a shell too.
It starts just as fast as Python too, if not faster, at least on my machine:
time python3 -c 'import os.path; print(os.path.exists("README.md"))'
time bb -e '(.exists (new java.io.File "README.md"))'
Python averages around 40-50ms, and bb averages 30-40ms.
Seems Python has more consistent startup performance (`4.5 ms … 9.8 ms`) while Babashka can startup faster (`0.4 ms … 10.6 ms`) but on average, Python startups faster.
This is a particularly joyful piece of open source software. After seeing Michiel Borkent -- its author and writer of OP -- present on it at a meetup, I wrote a tidy overview of babashka (bb) which you can find here:
It absolutely makes you happy. Be beware, finding a language that makes you too happy, can lead to you not wanting to program in anything else anymore. You're better off being in the middle of grumpy and happy, like a normal programmer.
Don’t worry, folks! Clojure will make you happy, but even with fast perf you may find yourself wanting static types or even just dynamic runtime result/option types. Of course it’s a lisp with macros, and a general purpose language, so you can have all of that too. But there’s no shortage of green in other pastures ;)
this is why i avoid common lisp now. for years i hated programming until i finally decided CL was dead to me. Now i happily write Python for a living and don't care it sucks relative to CL.
I'm doing Advent of Code in clojure for the second year. It's frustrating in some ways (learning the string-parsing to process the inputs takes longer to learn in clojure than to simply execute in C++, C#, or JS, but that's because I know those other languages much better).
But the pleasure of iterating towards the solution and building and quickly testing each of the constituents is joy-inducing.
That's funny because I've found the exact opposite. Most everything seems to use roughly the same utilities, but Clojure lets me move more quickly in getting the inputs parsed correctly.
For example, I often start with something like `(slurp "inputs/day-2")` and keep wrapping that until I get a structure I'm happy with. Then I split it into a few fns so I can keep testing with the smaller input
I'm at the stage of using clojure for a total of perhaps 50 hours, 40 of which has been in AoC 2021 or 2022 and no prior JVM experience to draw on the java library ecosystem fluidly (which is a massive strength of clojure, but one that I'm poorly equipped to use).
My solution times so far have scaled pretty heavily with "how long did I futz around with parsing the input?" I did well on days 3, 4, and 6, because the parsing was so trivial and it was just a quick function composition. Day 5 I spend entirely too much time parsing the input (In retrospect, I probably should have just edited it into an initial data structure in emacs.)
Honestly, I think a good chunk of the challenge with a lot of Advent of Code puzzles comes from parsing the input. That’s where I end up spending a lot of my time too, especially when it needs something more than parsing each line individually or reducing by lines.
Don't learn a Lisp. For one, you'll end up in endless arguments whether your Lisp is a proper Lisp, and two, everything else will look ludicrously constraining for no good reason.
FWIW, I work fulltime on a Clojure codebase. There are other companies who also use it (for a more well-known example Metabase). Somehow Clojure is a business-friendly Lisp, probably because of the JVM and all the enterprisey stuff that's available for it.
Yup, the JVM is the number one reason why I avoid it like the plague. Which is too bad because the language is super slick, I like it better than Racket and the other schemes.
Have you ever worked/tried to work with a lisp professionally? I don't think what you're saying is true, at least today. I've worked with many Clojure companies for the last years, for them lisp has already happen and is still happening.
Main drawback of using a lisp for professional development is that it's really hard to go back to anything else afterwards. "Why use Assembly if you have C?" (unless you have a really good use case for it, of course), that's a bit the feeling you get.
I think this is one of my favourite pieces of tech in the past five years tbh.
I still use bash for short <5 line scripts but everything else is bb (though I’ve started looking into nbb because you can use node libs like ink which seems pretty cool)
And repl integration with neovim and conjure is great!
super-easy shell interop + instant nREPL = replaces any complex bash script, driven from emacs!
what's more, you can namespace your scripts and import them. functionalizing code makes scripts easy to refactor, or even trivially move into a full Clojure backend or ClojureScript frontend. With squint-cljs you can even generate self-contained JavaScript directly from babashka code.
I'm a previous BeautifulSoup user and have found the combination of (1) having the scraped data presented in plain Clojure data structures, and (2) Hickory's built in selectors, to be a very nice experience.
I plan to port my scraping framework (Skyscraper, https://github.com/nathell/skyscraper) to babashka one day. I’m not sure how easy it will be, though, since it uses core.async (which I believe bb has limited support for) and SQLite via clojure.java.jdbc.
BB is awesome - it powers our RabbitMQ management scripts, we have written a sidecar process to scrape metrics from ECS and send them to vector.dev over UDP and a bunch of other things.
For personal stuff I use it in a lot of scripts used by Alfred.app including quick-fill for Things with date parsing, emoji completion, etc
I personally stopped using it since both shellcheck and jq fill their own niches way too nicely “unfortunately”…
None the less, a lovely tool and the couple of scripts I wrote are mostly still in use and well maintained for a reason ;) Clojure is just fantastic and so is the speed of the GraalVM.
- a lisp core, which you can use in your editor setup instead of sbcl or ccl, the advantage is that it loads instantly with all these libraries built-in (instead of quickloading all of them when needed)
- a readline REPL, with completion, syntax highlighting and some goodies (a shell passthrough, quick doc lookup…), albeit it needs more love
- a lisp library which you can quickload like the rest, it just comes with a bunch of dependencies.
- I want to add scripting capacity too.
It ships libraries for: HTTP requests, file formats handling (JSON, XML, CSV, TOML…), shell utils, file utils, threads, a nice hash-table notation, DB access, plotting, strings, other language extensions etc.
It is not finished but I am doog-fooding it for clients' projects.
where we can use all the available libraries, it works instantly.
It's brand new, not many options right now ;)
> like janet-lang
I don't think so, since Janet advertises itself as an embedable Lisp like Lua or Guile (and ECL). But yes, in the sense it comes with batteries included. Like Babashka, I guess.
Thanks for your initial question!
---
So, in CIEL scripts right now, we can make HTTP requests (dex:get or http:get), parse JSON, CSV etc, run shell commands (cmd:cmd, the "!" shortcut in the CIEL shell), or even
I think SBCL starts up fast enough as-is, no? If you want a batteries included version with libraries, just load them and save a new base image with SAVE-LISP-AND-DIE
It starts just as fast as Python too, if not faster, at least on my machine:
Python averages around 40-50ms, and bb averages 30-40ms.[0]: https://book.babashka.org/#built-in-namespaces