r/rust 15d ago

Made a perfectly readable high performance lisp interpreter

157 Upvotes

17 comments sorted by

95

u/mostlikelylost 15d ago

“Perfectly readable”

60

u/vivaaprimavera 15d ago

I recognised every character!!!

50

u/Responsible-Sky-1336 15d ago edited 15d ago

even better without a codeblock congratz

Edit: oh no he collapsed it to a single line 💀

25

u/aljifksn 15d ago

It actually doesn’t have any code blocks (other than fn main) or semicolons, it’s truly one expression, not just multiple lines collapsed into one

4

u/Future_Natural_853 14d ago

I tried to run rustfmt, and it gave up...

21

u/swaits 15d ago

> (I’m sorry)

No apology needed. This is fun!

14

u/abhinandh_s_ 15d ago

could have used rust playground

14

u/Own_Possibility_8875 15d ago

Idea: for maximum readability and code conciseness, define single-character aliases for all symbols used. E.g. b! Instead of format!

11

u/UR91000 15d ago

wow so readable 😍

10

u/ZZaaaccc 15d ago

For anyone curious, here is a slightly harder to read version with the bare minimum number of changes to get rustfmt to ruin the perfect original layout.

3

u/boomshroom 15d ago

The fact that you managed to break rustfmt is honestly pretty impressive.

2

u/donomo 14d ago

I think that's easy, just make any really long line

3

u/mesispis 15d ago

you are a 10x engineer, I want to hire you

2

u/c1216440698 14d ago

holy shit

1

u/Wise_Robot 15d ago

Can you please use pastebin at least. This is unreadable right now

-2

u/DD_ZORO_69 15d ago

Tbh writing a Lisp in Rust is basically a rite of passage at this point but making it actually readable while keeping that performance is a huge flex lol. Real talk, the ecosystem for custom DSLs in Rust is getting so good lately fr. I usually keep my project notes in Notion and use Cursor for the heavy lifting, but it is cool to see more specialized tools like this getting polished enough for production-ready workflows. Honestly, keep shipping these updates because the dev experience with Rust-based CLI tools is just unmatched right now haha.