Over a million developers have joined DZone.
Platinum Partner

Seven Languages in Seven Weeks: Prolog

· DevOps Zone

The DevOps Zone is brought to you in partnership with New Relic. Improving the performance of your app is easy with New Relic's SaaS-based monitoring.

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.

This time, I’ve just completed the chapter on Prolog. The previous chapter, which I found reasonably painful as well (but for different reasons) was Io. In the meantime, I’ve been doing a lot more work in another prototype-based language – JavaScript – and grown accustomed to the paradigm somewhat. For all its flaws (perceived or otherwise), I find JavaScript much easier to work with than Io, although I have to admit the learning experience with Io was still worth some of the pain.

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).

The DevOps Zone is brought to you in partnership with New Relic. Know exactly where and when bottlenecks are occurring within your application frameworks with New Relic APM.


Published at DZone with permission of Oliver Hookins , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}