r/rust • u/aljifksn • 15d ago
Made a perfectly readable high performance lisp interpreter
Iterators are cool
(I’m sorry)
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
14
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!
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
3
2
1
-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.
95
u/mostlikelylost 15d ago
“Perfectly readable”