• she/her

Principal engineer at Mercury. I've authored the Dhall configuration language, the Haskell for all blog, and countless packages and keynote presentations.

I'm a midwife to the hidden beauty in everything.

💖 @wiredaemon


discord
Gabriella439
discord server
discord.gg/XS5ZDZ8nnp
location
bay area
private page
cohost.org/newmoon

mehbark
@mehbark

about ten months ago, i wrote a ultraminimalist term-rewriting programming language in rust called slimp. it's about 850 lines of rust that you can see here. it lives its life powering one of the most esoteric discord bots i know of (also called slimp). i learned a lot and had a lot of fun! but... rust wasn't really the greatest fit.

a couple days ago, i decided to rewrite in common lisp. it was so much more fun! still tricky, but i was able to cheat (always a good thing in computer land) by using trivia a fantastic pattern-matching compiler. what i did was construct a program that would do what i want and then just... evaluate it. in my benchmarking, common slimp (yes, i am very proud of the name) consistently outperformed the rust implementation in all but the simplest benchmarks, only doing worse due to a higher constant overhead. in a benchmark that involved multiplying ten times ten times ten, common slimp was 62 times faster. nice!

i would be remiss to not mention that common slimp is not a conforming slimp implementation, because it uses the common lisp reader, it is case-insensitive, and it doesn't implement the (sometimes redundant) special forms that the original implementation does. still, i find the fundamental technique extremely satisfying, and i'd like to try it again sometime. also, the reason i haven't linked the common lisp implementation is because it's 50 lines,1 so i just put it in the post. sweet.


fullmoon
@fullmoon

There was a great /r/haskell comment from András Kovács a few years ago which explains how difficult it is to get good performance out of Rust when implementing an interpreter. That comment was comparing Rust to Haskell, but I believe a lot of the observations apply here (e.g. when comparing Rust to Common Lisp)


You must log in to comment.

in reply to @mehbark's post:

wait, so you used rust to create slimp and used js to make a compiler to read slimp arguments and make it usable for a bot on discord (not sure if i got that right)? also, what's lisp and how is it related to slimp or was that a separate project?

in reply to @fullmoon's post:

that's a very well-reasoned comment! i found it funny how he mentioned the lack of runtime code generation in rust and haskell—you can say many things about common lisp, but it's pretty great for generating common lisp code

the rust implementation sucks for many reasons though, it creates an egregious amount of hashmaps and, more broadly, suffers from an inertial unwillingness to delete code that rust only exacerbates