Seven Languages in Seven Weeks: Prolog
Yet another installment in my journey through Seven Languages in Seven Weeks. At this stage it is so far off seven weeks, it’s definitely going to be more than seven months, and I’m just hoping it won’t take seven years! But it is enjoyable nonetheless – if a little painful.
Prolog has a deeper hold on me than Io, though. I once took a second year university course on Logic Programming which had Prolog at the very core. The textbook and much of the workload for the course relied on using and understanding Prolog to learn the fundamentals of the course, and I did extremely poorly in it. In fact, I more or less gave up trying to understand and earned the worst grade out of my entire university career in that subject. So this time around I felt that I had something I needed to prove, at least to myself.
All of that said, it was still a big struggle. The paradigm is inherently unfamiliar to me, and it took a long time to understand even the basic exercises. The last couple of days I actually managed to implement something resembling a recursive insertion sort from scratch, which I was relatively pleased with, and the rest of the chapter was at least understandable. Take a look at my Github account if you feel like it – there are a lot of examples from the book and some of my own solutions to the exercises.
Would I use Prolog at my day job? Almost certainly not, but I feel like I’ve at least partially conquered the demons from university and I have definitely expanded my mind. Every time I learn a new language or new paradigm I feel the same exhilaration I did when moving permanently fromshell script to Ruby. Now I couldn’t imagine even attempting any given problem in anything less than a complete programming language, and shudder at the memory of some of the horrors I used to write in Bash.
If you haven’t picked it up, I strongly recommend reading and working through this book, even if you don’t consider yourself a programmer (maybe you’ll find yourself one by the end of it).