r/Clojure • u/joekunin • Nov 15 '16
r/Clojure
•
u/Ramirond
•
Jun 04 '26
Improving the performance of the popular Clojure development tool clojure-lsp
The story of how Sashko Yakushev (longtime Clojure performance specialist) cut clojure-lsp’s startup time in half and memory allocation by two thirds.
Btw, these changes have been merged to clojure-lsp released ✌️
r/Clojure • u/HappyAngrySquid • Jun 03 '26
I met Stu Halloway years ago.
It was the first time I’d heard of Clojure. My only experience with scheme prior to that was in Uni where I absolutely hated it. So, I made all the “herp dur parentheses!” comments you’d expect from a douche bag. Stu was unreasonably kind and patient.
Anyway, Clojure is now one of my favorite languages. And Stu is awesome, and I thought I should share this anecdote which just popped into my head.
r/Clojure • u/flyingfruits • Apr 14 '26
Typed multiple dispatch as a Clojure library — how we built Julia-style polymorphism on the JVM
I've been building Raster, a typed multiple dispatch system for Clojure that brings Julia-style polymorphic dispatch to the JVM. It's a library, not a language fork — you write regular Clojure, define functions with deftm instead of defn, and get devirtualized, compiled code.
I wanted to share the design because it touches on several PL topics that I think are interesting: dispatch semantics, type-directed compilation, and how far you can push a host language's macro system before you need a new language.
The dispatch model
Julia's key insight is that multiple dispatch over concrete types, combined with specialization, gives you both expressiveness and speed. Raster adopts this: deftm defines typed methods with :- annotations (based on Typed Clojure). Multiple methods with the same name but different type signatures coexist, and dispatch picks the most specific match at call time.
(deftm add [x :- Double, y :- Double] :- Double (+ x y))
(deftm add [x :- Long, y :- Long] :- Long (+ x y))
(deftm add [x :- Complex, y :- Complex] :- Complex ...)The walker sees (add x y), knows the types of x and y from annotations and inference, and replaces the generic dispatch with a direct call to the concrete implementation. At runtime, there's no dispatch — just a method call that the JVM can inline. This gives us 4ns per call vs 100ns+ for runtime dispatch, and it makes the code more predictable for the JVM JIT compiler.
The compiler
This is where it gets interesting from a PL perspective. deftm isn't just a macro that emits defn with type checks. It feeds into a nanopass compiler pipeline:
Walker — devirtualizes dispatch calls, resolves types, replaces polymorphic operators with concrete implementations
Lowering — expands parallel combinators (
par/map,par/reduce) into loop IRInlining fixpoint — iteratively inlines
deftmcalls, re-walks, simplifies, until stableAD expansion — if the function passes through
value+grad, reverse-mode AD templates are expanded into flat binding sequences (closures-as-tape, but the tape is eliminated at compile time)Buffer fusion — rewrites allocating operations to reuse dead buffers (zero heap allocation in hot paths)
SOAC fusion — fuses map-map, map-reduce chains (borrowed from Futhark's approach)
Backend — emits JVM bytecode via the ClassFile API, with SIMD vectorization for parallel forms; or emits OpenCL for GPU acceleration
Every pass has a defined input/output dialect, validated at boundaries. You can inspect any stage with explain-pipeline. In the ideal case it compiles a function into a single JVM class with no boxing, no allocation, and primitive-typed fields for hoisted buffers.
What makes this work as a library
Clojure gives us three things that make this feasible without forking the language:
Macros over data — Clojure code is data (lists, vectors, symbols). The walker is just a tree transformation over S-expressions. No parser needed.
evalat macro time —deftmcan register methods, generate classes, and compile code during macro expansion and runtime. The REPL stays interactive.Dynamic classloading — the JVM's
DynamicClassLoaderlets us emit bytecode at runtime and have it JIT-compiled by HotSpot's C2. We get the same optimization pipeline as ahead-of-time Java code.
The tradeoff: we're limited by what Clojure's macro system can see. We can't do whole-program optimization across compilation units the way Julia or GHC can. Our fixpoint inliner approximates this by iteratively inlining and re-analyzing, but it's bounded by which functions are transparent to the system (deftm, custom defn).
Parametric types
We support Typed Clojure's parametric polymorphism via (All [T] ...):
(deftm norm (All [T] [x :- (Array T), n :- Long] :- T
(let [s (par/reduce + 0.0 (par/map (ftm [xi :- T] :- T (* xi xi)) x n))]
(sqrt s))))T gets specialized at each call site — (Array double) gets one compiled version, (Array float) gets another. The parametric registry caches specializations. This is monomorphization, similar to Rust/C++ templates but triggered lazily at first use.
AD as a compiler pass
Raster supports Dual numbers for runtime forward automatic differentiation. Automatic differentiation isn't only a runtime mechanism (like PyTorch's) or a source transformation tool (like Zygote.jl). Reverse mode automatic differentiation is supported as a compiler pass: the AD transform takes a walked function body, generates the backward pass as flat let-bindings with explicit gradient accumulation, and feeds the result back into the same optimization pipeline. The output is a single compiled function that computes both the value and gradient with no tape overhead.
This means AD composes with everything else — buffer fusion eliminates intermediate gradient arrays, SOAC fusion merges forward and backward parallel loops, and the backend emits the whole train step as one JVM method or GPU kernel.
Where it stands
Raster is at 0.1 and in an explorative stage. Beyond the core dispatch + compiler, it includes scientific computing (ODE/PDE solvers, optimization, FFT), linear algebra (LAPACK via Panama FFI), deep learning primitives (conv, attention, normalization with AD), and GPU backends (OpenCL, Level Zero). The compiler produces code competitive with Julia and JAX on numerical workloads — not uniformly faster, but in the same ballpark, which I think is notable for a JVM-hosted library. The overall goal is to facilitate modeling and simulation on Clojure's persistent memory model, based also on our durable persistent data structures.
The thing I'm most interested in discussing: is "compiler as a library" a viable long-term strategy, or does this approach inevitably hit walls that only a proper language can solve? We've gotten surprisingly far with macros + eval + dynamic classloading, but there are real limitations around cross-module optimization and type information that doesn't survive Clojure's compilation model.
Happy to discuss any aspect of the design and I would also be interested in what other people need. The code is at github.com/replikativ/raster.
r/Clojure • u/thefakelorlyons • Jun 21 '25
Update: I made a brain-computer interface library in Clojure, thanks to the support of all of you!!
Some of you may remember this post a couple months ago when I crowdfunded a project to bring BCI (brain-computer interface) tooling to the Clojure ecosystem? Well — it's here. Introducing BrainFloj (and brainflow-java, upon which it is built), an alpha-stage Clojure library meant for EEG streaming + analysis, and most importantly, application development that wraps the BrainFlow API and brings mind-controlled apps one step closer to the REPL and hopefully even non programmers. 😄
This isn't just another API wrapper. BrainFloj creates a persistent .lor/ directory system where users can record personalized "wave-signatures," build calibration profiles, and create complex libraries of signature “categories”. The classification system is complete, meaning you can literally record your brain thinking "up" or "down" (in the case of the pong example) and use those patterns to control applications. I've already built the aforementioned Pong example as a demo, and the foundation is there for "brain-macs" - keyboard shortcuts triggering recordings that seek out specific neural signals in order to issue custom commands to any application! All built with idiomatic Clojure code.
A tremendous thanks again to everyone who encouraged, donated, or just cheered me on — Your support made this possible, and I couldn't be more grateful to this community. I’m very proud of how far this has come and would love for others to try it out or build with it. Feedback, PRs, and any wild brain-computer ideas are welcome! Thank you, Clojurians for contributing to making science fiction reality!
As a bonus, this comes in the wake of a talk I did about brain data analysis for the SciCloj Light conference recently;And in a few weeks, the London Clojurians will be releasing a recording of another talk I gave at reClojure, this time focused on BCI tech, and where I officially announced this library for the first time live. I will be sure to share that when it comes out!
I am really looking forward to continuing work on this and maybe collaborating with people on it. Thank you once more to everyone who has helped me along the way!!!! I will be releasing more videos, documentation, and examples as time goes on; demonstrating the library, and hopefully showing off more things I plan on building using this same library.
r/Clojure • u/abogoyavlensky • Apr 09 '25
Introducing Clojure Stack Lite
A quick way to bootstrap your Clojure projects with a modern, lightweight Server-side Rendering stack that focuses on simplicity and developer productivity:
Integrant/Reitit/HoneySQL
SQLite persistence
HTMX-powered UI with TailwindCSS
CI/CD with Github Actions and Kamal
Linting, formatting and tests
deps.edn and Babashka Tasks for project management
Basic PWA support
This template lets you focus on writing your application logic rather than configuration.
Check out the documentation and get started!
r/Clojure • u/jpmonettas • Nov 11 '24
ANN: FlowStorm 4.0!
Hi everybody! I'm happy to announce the release of FlowStorm 4.0 with a bunch of new features and bug fixes!
The most interesting features being :
A new, extensible value visualization system which supports :
a way to navigate nested structures in a lazy way
visualize and navigate metadata
multiple visualizations for each value
lazy/infinite sequences navigation
a way to define the current sub-values so you can use them at the repl
a mechanism for realtime data visualization
clojure.datafy navigation out of the box
tools for the user to add custom visualizations on the fly
A redesigned value search window with support for data windows value searches
A new Outputs tool for repl evaluations, taps and output streams visualization
The User's guide and in-app tutorial have been accordingly upgraded.
I also created this repo in case you want to quickly try the new data exploration and custom visualization features, which also contains a couple of short videos demoing some realtime data visualizations.
I hope people find it useful, feedback is welcome and please show up in #flow-storm if you have any questions!
r/Clojure • u/Jeaye • Oct 14 '24
jank development update - Moving to LLVM IR
r/Clojure • u/ikitommi • Aug 08 '21
Malli 0.6.0 is out - performance, instrumentation and dev-tooling
We are happy to announce [metosin/malli "0.6.0"], a summer vacation edition. Malli is a complete validation and specification library for Clojure/Script. The release has the following changes:
new tools to instrument function values and schematized vars
new repl/development tools to watch function registry emitting clj-kondo & instrumentation on changes (clj only)
optional fipp-based pretty printer for runtime (function schema) errors
support for var-metadata based function schemas - annotate your code without dependencies to malli
proper function schema guide: https://cljdoc.org/d/metosin/malli/CURRENT/doc/function-schemas
robust humanized errors - error forms are derived from the first error, fixes all reported bugs
much faster collection validation and transformation, kudos to Ben Sless for the hard work on this!
new malli->plantuml schema transformer
lot’s of small improvements
small breaking changes, check CHANGELOG for details.
Big thanks to all contributors and testers!
If you are interested in using or developing malli, there is #malli on Clojurians Slack.
CHANGELOG:
https://github.com/metosin/malli/blob/master/CHANGELOG.md#060-2021-08-08
The new dev-tooling in action:

r/Clojure • u/Fierycodev • May 04 '21
Announcing holy-lambda. The micro framework that integrates Clojure with AWS Lambda on either Java, Clojure Native, or Babashka runtime.
It's my first post here announcing holy-lambda https://github.com/FieryCod/holy-lambda. I've resisted posting it for almost two years since it was far from being production-ready software. On the other hand, today, holy-lambda reached version 0.1.45 with some great features and fixes included. It's high time to show this project publicly.
Holy lambda is a unified micro-framework that utilize AWS SAM and Babashka tasks to provide the best possible support for following runtimes:
Babashka(https://serverlessrepo.aws.amazon.com/applications/eu-central-1/443526418261/holy-lambda-babashka-runtime),Clojure (GraalVM),
Clojure (Java).
Features
Fully managed environment via
bb tasksTarget either Java, Native or Babashka runtime from one code
Interactive development in Babashka runtime
Fully automated native configuration generation via
bb native:confFastest possible JSON parse, encode library
metosin/jsonistaincluded in native runtime. Fallbacks tocheshireforBabashkaruntimeAutomated stack deployment/deletion, bucket creation/deletion
Health check of the stack via
bb stack:doctorandbb stack:describeInterceptors support
Changes in 0.1.45:
Add
Babashkalayer with built into support forBabashkapods and additional Clojure. Check: here and hereReplace makefile build system with bb tasks
Bump
holy-lambdatemplate. The template is now fullydeps.ednbased.Make
Babashkaruntime interactive. Sources are distributed without packing to .jar.
Incoming changes
Add benchmarks of runtimes
Add Node.js compatible runtime
Refine documentation
Fix first sync error
Add PGO optimizations for GraalVM Enterprise
For chatting about native runtime, Babashka runtime, or holy-lambda micro-framework join #holy-lambda channel on Clojurians.
Acknowledges
@borkdude - a wizard who spent enormous time helping me out with
deps.clj,Babashkatasks, andBabashkaruntime. Thank you!@viesti - thanks for inspiring me to support
Babashkaand all the discussions.@Eugene Koontz - thanks for being the first contributor!
@holyjak - hereby granted permission to use the word
holy:D@Dainius Jocas - Thank you for making the first
Babashkalayer. Looking at your code helped me lot with makingholy-lambda-babashka-layer
EDIT: If you looking for some examples then check this folder.
r/Clojure • u/dilzeem • Mar 09 '21
What are your favorite Clojure/script youtube channels?
I just thought I post some channels that I really like, and I wish there were more content coming from them.
While the conference videos are nice/cool I instead generally like the stuff that help people get started and using clojure or if they are just short and to the point and show they have solve a problem explaining their thought process.
AdamJames-tv: is quite a new channel, but so far really like what he has done so far. I really hope he keeps it up.
learnui: I haven't had a real chance to go through the videos properly yet, but looking forward to seeing more of it.
Kevin Mai: Quick and explains things really succinctly.
Between two Parans: A really nice series with reframe, and quite polished editing and camera work.
nilenso: really good basic stuff, and discuss the workflow when using clojure
Fred Overflow - Advent of Code 2020: I just really liked how elegant his solutions were, and the videos are all quite short.
I may have missed some, but these are the ones that I remember and I have subscribed to so far.
Please post some of your favorite channels as well.
r/Clojure • u/thheller • Feb 20 '21
shadow-arborist: Braindump
Lately I find myself trying to think about too many topics at once and my productivity has tanked in the process. I do think these topics are worth thinking about but I can't do them all at once on my own.
The first 2 are about component reusability and async rendering and I might make a few more in the upcoming weeks. I didn't want to turn this into a whole blog series and mostly wrote this down for myself. I'm only posting them here because people previously have expressed interest in my work on shadow-arborist and shadow-grove and might be interested in this. Currently that work lives in the shadow-experiments repo.
For those that missed it: shadow-arborist is my attempt at writing a react alternative in pure CLJS with no other dependencies. shadow-grove is the higher level "component library" on top. It would be fair to compare them to reagent being built on top of react. Sorry about the names, everything is somewhat related to trees.
https://github.com/thheller/shadow-experiments/blob/master/doc/reusable-components.md
https://github.com/thheller/shadow-experiments/blob/master/doc/async.md
In those posts I just mostly talked about the stuff that already exists and decisions I made in the process. Writing about the actual unformed ideas that I haven't settled on is difficult. I hope to get everything out of my head at some point so I can get back to focusing on specific issues that actually need solving.
Edit: Wrote another post.
r/Clojure • u/blak3mill3r • Jul 13 '20
Babashka bringing me joy
I have been discovering more ways that bb can improve my life.
I just released a tool which wraps CRIU (linux process checkpoint/restore) to make Emacs "start" (a cloned process) in ~300ms.
I've been using something like this for a while, but I just reimplemented the meat of it with Babashka, which was just delightful!
I thought I would share it here as an example of how easy and practical it can be to use bb today as a replacement for python or bash.
The bb source code:
https://gitlab.com/blak3mill3r/emacs-ludicrous-speed/-/blob/master/bin/els-cloner
Part of this project:
r/Clojure • u/dragandj • Apr 09 '20
CuPy accelerates NumPy on the GPU? Hold my Cider, here's Clojure!
r/Clojure • u/dragandj • Aug 26 '19
The grass is *not* always greener on the other side of the fence
Today I've stumbled on this list of complaints about Scala technology and politics.
https://medium.com/@fommil/scala-almost-succeeded-c3b1028b02c5
Reading through it I couldn't help but noticing how Clojure avoided most of these pitfalls.
So, maybe, sometimes, when we are frustrated by some tiny thing in Clojure that is not exactly perfect, maybe it's worth taking a step back and noticing how difficult a job it is to create and maintain a language and ecosystem.
So, Rich, Alex, and the rest of the Clojure Core team seem to be doing wonderful work with tiny resources they have.
Thank you, Rich, thank you, the Core team, thank you Clojure community for all the hard work!
r/Clojure • u/yogthos • Aug 29 '26
Wrapping GTK4 in 800 lines of Clojure with Jolt
yogthos.netr/Clojure • u/Borkdude • May 25 '26
All babashka conf 2026 videos are up on Youtube now!
Have fun watching!
https://www.youtube.com/playlist?list=PLaN-rC-CjQqCClhXmwzE7XhGWbrbB-A7u
r/Clojure • u/Rschmukler • Feb 26 '26
Announcing Hyper: A reactive server-rendered web framework for Clojure
Today we are open sourcing Hyper. It's built on the ideas presented in From Tomorrow Back to Yesterday. It's early days so expect things to evolve but we welcome contributions and ideas from the community
r/Clojure • u/alexdmiller • Jan 12 '26
How to stick with your projects, even when they're janky - Jeaye Wilkerson
r/Clojure • u/BrunoBonacci • Jun 09 '25
reClojure 2025: Simple ideas with huge impact from Clojure and Rama by Nathan Marz
Hi all,
Thank you to all the people who attended reClojure 2026 in London. We are in the process for editing and publishing the video from the conference.
Here is the playlist of the conference, we will keep uploading the videos and adding them here. https://www.youtube.com/playlist?list=PLtw0bWXdq7pMmm1ALroZ_c5aZB-l4V06V
Today we start with the keynote by Nathan Marz with the title
Simple ideas with huge impact from Clojure and Rama
https://www.youtube.com/watch?v=25lJNRibYv8&list=PLtw0bWXdq7pMmm1ALroZ_c5aZB-l4V06V
The London Clojurians team, reClojure organisers