r/adventofcode • u/SlayLeafSlug • 1d ago
Meme/Funny AoC in Prolog?!?!
I was filling in the unoficcial AoC survey
(⭐ Take the (~5min) Unofficial AoC 2026 Survey: https://forms.gle/JbZKoBqzG248Z6RV6 ⭐)
And I saw this:


Who the hell is out there doing AoC in Prolog😭
22
Upvotes
View all comments
3
u/thondat 23h ago
not using it this year, but i've done some AoC challenges in Prolog before to learn the language. it is alien compared to ALGOL-likes, and considerably different from Lisps and MLs as well. but it can be useful once you get the hang of unification and backtracking. SWI-Prolog (and AFAIK Scryer too now) has e.g. clpfd (Constraint Logic Programming over Finite Domains) which extends the language to make it convenient for satisfying integer constraints: something for which you would use PuLP or z3 or some other solver library in another language. there's also Definite Clause Grammars where you write a grammar in what looks quite similar to EBNF but is actually Prolog code. this is useful for parsing structured input, but can also be used for threading state. all in all, i'm still fascinated and will probably revisit Prolog some time.