HN.zip

Show HN: I made a Clojure-like language in Go, boots in 7ms

Let-go is a Clojure-like language (~90% compatible with JVM Clojure) written in pure Go. It ships as a ~10MB static binary and cold boots in ~7ms - that's about 50x faster than JVM and 3x faster than Babashka. It has decent throughput on algorithmic workloads - within ballpark of the GraalVM-backed sci.I started this project in 2021 as an elaborate practical joke: I wanted to have an excuse for writing Clojure while pretending to write Go.Jokes aside, it turned out to be pretty decent: it feels like real Clojure, it has an nREPL server (supported in Calva, CIDER, etc.), it's easily embeddable in your Go programs (funcs, structs and channels cross the boundary without fuss). It's good for writing CLIs, web servers, data processing scripts and even doing some systems programming - I used it to write a deamonless container runtime. Oh, and it runs on Plan9.Under the hood there is a fairly simple compiler and a stack VM, both handcrafted specifically for running Clojure-like code. The compiler can work in AOT mode producing portable bytecode blobs and standalone binaries (runtime+bytecode).This is not a drop-in replacement for Clojure in general - it does not load JARs, it does not have all Java APIs and it most probably won't run your exiting Clojure projects without modifications. At least not at the moment.Take it for a spin, tell me what you think. Issues and PRs are welcome!

182 points by marcingas - 48 comments

48 Comments

veqq [3 hidden]5 mins ago
Nice! I recently played around with a Lisp syntax for Go semantics: https://codeberg.org/veqq/Joe

As far as JVM-free Clojure-like, Janet is really nice. I've been using it in production for a while: https://janet-lang.org/ There's also Fennel if you want the Lua vm and libraries.

marcingas [3 hidden]5 mins ago
Thanks! Joe looks good! As for Janet - never tried it myself but I always thought it's doing its own thing instead of trying to be Clojure.
TJSomething [3 hidden]5 mins ago
While Janet pulls from a few inspirations, the syntax is pure Clojure. I always figured that it was trying fix up the bumpy parts in Fennel to enable a programming style that was more consistently Clojure-like and functional than could be done in Fennel, since Fennel ultimately has to use Lua's semantics because Fennel compiles to Lua.
ingy [3 hidden]5 mins ago
Try out this Wasm browser REPL https://gloathub.org/repl/

Gloat is a Glojure AOT automation tool. I worked with James Hamlin to get Glojure AOT going last summer and have been moving it forward since. I've also been working with marcingas (nooga) to get Gloat/Glojure/let-go all cooperating.

boguscoder [3 hidden]5 mins ago
Micro nit: it says 7ms cold start and then 6ms just few lines lower.. maybe it gets faster as you read README
marcingas [3 hidden]5 mins ago
Fixed, thanks! It's 6-7ms on my machine. Median seems to be around 6.5ms :)
bjconlan [3 hidden]5 mins ago
This is the kind of clojure port that I always was looking for. Mostly because I thought go's core library and channels abstractions hits a simpler/nicer base API which would with the core & async apis (not to mention scratches my big beautiful binary itch)

Thanks for your work will definitely check it out again once I get over renewed love for cpp (26)

Edit how did glojure go under my radar also a great project from the looks

giancarlostoro [3 hidden]5 mins ago
I have played with the idea of making a “old school PHP” style DSL that takes advantage of the Go runtime and packages under the cover. I say old school PHP because PHP used to be a web focused DSL its no longer the case, I feel like it would make for an interesting easy to use backend language similar to PHP but with the full power of Go behind it. Clojure is an excellent choice.
marcingas [3 hidden]5 mins ago
Thanks for kind words! Please don't forget to drop me an issue or two when you eventually get to it :)
lsh0 [3 hidden]5 mins ago
An alternative is Joker: https://joker-lang.org

I think it is brilliant and completely underappreciated :)

marcingas [3 hidden]5 mins ago
What I appreciate about Joker is how smoothly it wraps Go libs. It seems that they have covered everything that Go has to offer.

I'm trying to avoid adding too much though, I like that let-go fits in 10MB :)

lenkite [3 hidden]5 mins ago
I wish this had a better language name than just "lets-go". How about "clogo" ?
phplovesong [3 hidden]5 mins ago
There seems to be a surge in compile to Go projects recently. To me this signals that the runtime / stdlib of Go is one of the best out there (when going the GD'd route), but the surface level (syntax) is too simple/verbose and lacks the expressiveness developers want.

So far Lisette (http://lisette.run) seems to be the best/most active version of a compile to Go language out there.

chr15m [3 hidden]5 mins ago
marcingas [3 hidden]5 mins ago
faangguyindia [3 hidden]5 mins ago
I am finding i need "Rails" but i like single binary deployment of Go and fast/low resource usage like Go.

Is it possible for now?

marcingas [3 hidden]5 mins ago
I think you could make a framework on top of this. It doesn't yet run unmodified Clojure libs like hiccup but it wouldn't be hard to roll something relatively simple and solid in let-go. IMO
achenet [3 hidden]5 mins ago
This is beautiful, makes me wish I'd made it.

Excellent work, thank you for sharing it with us ^_^

dmitrygr [3 hidden]5 mins ago
You should see how fast libc gets mmaped() into the VM and the first instr runs :)
marcingas [3 hidden]5 mins ago
Sure, I should clarify: The 7ms here is measured at the point where let-go starts executing user code. It takes 7ms to initialize the compiler, load all stdlib namespaces and compute all vars. So it's not "time to first instruction", it's "time to running your code".
brazukadev [3 hidden]5 mins ago
do you know about Glojure?

https://github.com/glojurelang/glojure

marcingas [3 hidden]5 mins ago
Yes, I know about this one. I'm even comparing against it in my benchmarks :)
rcarmo [3 hidden]5 mins ago
You need to update the go-joker numbers, I removed the GIL yesterday or so and did some changes to the IR. ;)
marcingas [3 hidden]5 mins ago
I think I've pulled the latest today but will double-check and update them again tomorrow. I'm still puzzled why it doesn't run the tak function. Btw. Have you tried running my benches? I'm very curious about your results!
ingy [3 hidden]5 mins ago
https://github.com/gloathub/glojure is the actively maintained fork.
j3s [3 hidden]5 mins ago
absolutely sick of reading through obviously AI-slopped READMEs. it's your project, take a little pride and tell me why i should like it quickly instead of asking your agent to rattle off a list of features -- it's severely boring & offputting.
marcingas [3 hidden]5 mins ago
Thanks for feedback. Here's a pre-AI-slopped README https://github.com/nooga/let-go/blob/98c2e2ebf38519bceb4f799...

You can also refer to the HN post itself - it says why I think it's cool.

jimbokun [3 hidden]5 mins ago
This version is infinitely better.
j3s [3 hidden]5 mins ago
apologies if i was blunt - readme sloppage is a particular annoyance of mine that is quickly becoming common. i'm not against vibecoding, far from it. but a readme is a part of a project that humans immediately touch - seeing it littered with em-dashes signals carelessness.

i appreciate you taking my feedback with grace.

rcarmo [3 hidden]5 mins ago
I would like to point out, again, that em dashes are very much used by humans that run macOS or iOS — like in this case.
marcingas [3 hidden]5 mins ago
No worries at all. I understand your point. I'll look into fixing this!
stingraycharles [3 hidden]5 mins ago
Why did you feel the need to slopify your README? The original version read much, much better.

I genuinely don’t understand why people do this.

marcingas [3 hidden]5 mins ago
Good question, perhaps I really was just careless. I'll look into fixing the README.
stingraycharles [3 hidden]5 mins ago
It’s all good. Your project is awesome (and I say this as someone who has done Clojure fulltime for 5 years and nowadays write mostly Go).
uxcolumbo [3 hidden]5 mins ago
What made you stop using Clojure? Lack of Clojure jobs? Or something else?
stingraycharles [3 hidden]5 mins ago
Job offer I couldn’t refuse that didn’t have Clojure.

Now I work for a fully remote team, can work anywhere in the world, at any moment I want, leading the data / cloud team for a distributed timeseries database.

Can’t complain. :)

Clojure has had a huge, fundamental impact on my way of approaching software development. I actually came from a Haskell / C++ background, but the way Clojure treats data still has a fundamental impact on how I reason about data, architecture and simplicity.

I did have some issues with how Clojure is managed and do not always subscribe to Rich’s vision (I think core.spec makes no sense, a heavily macro based global state registry is fundamentally not how I would design this, and malli is infinitely better. same for core.async vs manifold), but that is a minor detail in what was a transformative experience for me.

I believe I am not alone when I say this.

I’m still following things from a distance. Considering the current thread, I’m actually very interested in yank, which is Clojure on LLVM, and have been sponsoring that project for a few years. That would be very nice if it could enter stable state, I may take another look again.

asdfasd323f [3 hidden]5 mins ago
obviously vibecoded
marcingas [3 hidden]5 mins ago
Yes, I have used AI to boost Clojure compat and fill out some blanks but the runtime itself is not vibecoded. I wrote it myself between Jan 2021 and July 2023. All commits on GH.
jeremyjh [3 hidden]5 mins ago
Did you even look at the repo history? Clearly it blasted off this year that way but that isn't how it started. Probably he got way more into it once he could make faster progress on all the yak shaving required to make it more useful.
marcingas [3 hidden]5 mins ago
Yeah, pretty much. I abandoned it in 2023 due to lack of time. At this point it had enough lift for solving AoC problems and writing small scripts. I've recently dusted it off and did the boring parts of the "roadmap" with Claude.
asdfasd323f [3 hidden]5 mins ago
I did. And it looks like you did too. Which is why you answered your own question in the second half of your comment, quite amusingly. "Probably" LOL!
jeremyjh [3 hidden]5 mins ago
So...you didn't ?

https://github.com/nooga/let-go/tree/d9dc094822b2983ebf44604...

In 2023 he had a working Clojure compiler with:

Macros with syntax quote, Reader conditionals, Destructuring, Multi-arity functions, Atoms, channels & go-blocks a'la core.async, Regular expressions (the Go flavor), Simple json, http and os namespaces, Many functions ported from clojure.core, REPL with syntax-highlighting and completions, Simple nREPL server that seems to work with BetterThanTomorrow/calva,

asdfasd323f [3 hidden]5 mins ago
Fuck off idiot. Lmao. If I saw you IRL i would slap the fuck out of you.
blanched [3 hidden]5 mins ago
You made an account just to post this low effort “criticism”? What’s the point?
adi_kurian [3 hidden]5 mins ago
Is it bad? Did you try it?
asdfasd323f [3 hidden]5 mins ago
The readme clearly has abundant emdashes and emojis everywhere, the code itself is obviously vibed. Not really sure what you're objecting to, to be honest.
marcingas [3 hidden]5 mins ago
Yeah, it has em dashes alright. But the emojis you're referring to were committed in January 2023 (0c4925c). But that's besides the point I guess. What is your point?
asdfasd323f [3 hidden]5 mins ago
My point is your project is a piece of shit.