Hacker News new | past | comments | ask | show | jobs | submit login

Summary: They needed to do some complex queries on data in a SQL database, queries that were clearly better suited for Prolog. So they 1) queried for the relevant data from SQL, 2) formatted the data into the form of Prolog terms and dumped it into a file, 3) fired up the Prolog interpreter and loaded the data along with a small amount of Prolog query code, 4) ran the Prolog queries, 5) formatted the results into CSV and dumped it into a file, and finally 6) imported the results back into SQL. While it has some hacky elements, this approach took just one day to implement, as opposed to the projected months it would have taken to do it without Prolog.

If I understand it right, Prolog is being used kind of like a more powerful version of Awk / Perl. The Power of Prolog [1] describes a somewhat similar use of Prolog: storing server logs as Prolog terms and then running complex queries directly on the log files.

[1] https://www.metalevel.at/prolog/business




> Prolog is being used kind of like a more powerful version of Awk / Perl

I have limited experience with Prolog, but it is not just a quick and dirty scripting language (how I view Perl). They were able to build the system so fast, because they only needed to translate the customer's requirements into Prolog declarations, and the Prolog engine is powerful enough to solve the constraints. In my experience, imperative code rarely has a 1-to-1 relationship with the requirements like this.


Maybe it would be clearer if I said Prolog was being used like a "much" more powerful version of Awk / Perl. Consider the server log case I mentioned. A question you might ask of a server log is: Are there any client requests that were not served? That query is an easy one-liner. You can go a little further and say: Give me the IPs of all the client requests that were not served. That query is also easy, maybe just another line or two. It would be a lot harder to get that information with Awk etc, but the spirit is the same: you have a bunch of data, and you want to extract some particular information, and you want to do so without a lot of pomp.




Consider applying for YC's first-ever Fall batch! Applications are open till Aug 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: