loading...

re: What are the hardest programming languages you have ever learned? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I think Prolog was the weirdest of the bunch. Having backtracking done automatically in a language is a far from normal concept although, once you ...
 

What is Prolog like as a language? Is it still used for anything non-Legacy?

 

I've heard of people codegen'ing other programs from Prolog. So like generating Java boilerplate based on simple logical rules and relations. I've never seen it done, but it sounds plausible.

I heard you can do that with Agda, Coq, miniKanren, Lisp, and Idris. I guess Lisp macros are kinda simpler than general Term rewriting. By the Curry Howard correspondence type-level programming in a dependently typed language (a language in which types can depend on values) is the same as programming in a relational logic language (Prolog) although I am probably mistaken about a few things... youtube.com/watch?v=HnOix9TFy1A&t=...

 

You bet. These days prolog is incarnated as Erlang.

 

I had to use Prolog in a Programming Languages course in college. I never knew something like it existed. It's actually Turing complete and people have made weirdly complex things with it, such as a text editor. But otherwise, it's basically a database/logic querying system?

All I remember is a fun fact, that in the 90s (80s?) there was a research effort in Japan called the Fifth Generation Computer Project to create a proper advanced OS similar to supercomputers with builtin AI (?) and they used Prolog. After hundreds of millions of dollars and years of intense effort, they just gave up. Everyone else just used C and then we got Windows.

 

I don't have much experience with it but, as I understand it, you specify rules and facts and, based on those, you execute a query.

Currently it is being used at the university I studied to automatically generate the timetable for each faculty (which class is where and when) since it fits the language very well. You have teachers that are available at a certain time interval each day, rooms that fit a certain number of people, classes that have to be before other classes and so on.

Those are your facts and rules, after which you could tell Prolog "give me all timetables". Using backtracking it will automagically find states that meet those criterias, in this case, a valid timetable.

 

It's like sticking a brute force solver in a maze and hoping it doesn't get stuck at a dead end.

Well I think you can give it tactics, but I think in the future with parallel CPUs and then Quantum computers and smarter compilers non-deterministic programming is the future. Right now search is like Garbage Collection, Higher-order functions, and interactive REPLs was back in the 1960s with APL and Lisp; it was too slow for PCs, so a bunch of teens grew up learning to program in low-level languages and forgot that better things could be possible.

 

There actually was a pretty big online course by SWI Prolog that just finished. Next one is on expert systems, but not sure when. Recent focus on AI and ML is bringing Prolog back, at least in certain domains.

code of conduct - report abuse