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

I recently went through what I'm calling a "conversion experience" with Prolog. I was writing a compiler and a link to Warren's 1980 paper "Logic Programming and Compiler Writing" went by here on HN ( https://news.ycombinator.com/item?id=17674859 .) After a brief learning curve I now have a much more powerful compiler in about 1/5th of the code.

There are a few problems that don't fit well with Prolog, but not many. For everything else, if you're not using Prolog you're probably working too hard.

Consider that achieving feature parity with 1/5th the code means 1/5th the bugs, right off the top.

But often Prolog code is more useful than some equivalent imperative code, for example, a Sudoku relation defined in Prolog serves to solve puzzles, but it can also generate new puzzles and verify partial puzzles (count the solutions and assert that there's only one.) https://swish.swi-prolog.org/p/Boring%20Sudoku.swinb

Prolog is also old.

I keep thinking, "What about FOO?", only to find that FOO has been explored years ago by a group of researchers, and often there is working code off-the-shelf and ready to go to solve whatever problem.

Anyhow, TL;DR: For goodness' sake please check out Prolog. It's like time-traveling into the future.




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: