Live data from Hacker News

Ask HN: What's Prolog like in 2024?

news.ycombinator.com

51–60 of 289 posts

Re: Ask HN: What's Prolog like in 2024?

#51
post #25

Not sure about Prolog itself but Datalog really needs to overtake SQL, it's just so much better. Related areas like constraint programming are still very relevant.

Could you explain more or point out some interesting references? I'm currently trying to understand how Datalog compares to SQL and, potentially GraphDBs

TypeDb is a practical Datalog-based database system [1] (with a different syntax). TerminusDb is a project in a similar vein [2], but actually an RDF store at its core. If you want to experiment with the connections between Datalog, relational algebra, and SQL, check out the Datalog Educational System. And if you want to jump into the theory, Foundations of Databases (the "Alice book") is very thorough but relatively readable [4]! Oh, and there's a Google project, Logica, to do Datalog over Postgres databases [5].

[1]: https://typedb.com/ [2]: https://terminusdb.com/ [3]: http://www.fdi.ucm.es/profesor/fernan/des/ [4]: http://webdam.inria.fr/Alice/ [5]: https://github.com/evgskv/logica

Re: Ask HN: What's Prolog like in 2024?

#52
Prolog, and Constraint Programming especially are great to have in your toolbox. I’ve done research in the field for years, and my job in the industry today is writing Prolog. There are real issues with Prolog:

- no proper module nor package system in the modern sense.

- in large code bases extra-logical constructs (like cuts) are unavoidable and turn Prolog code into an untenable mess. SWI prolog has single-sided unification guards which tackle this to a degree.

- lack of static and strong types makes it harder to write robust code. At least some strong typing would have been nice. See Mercury as an example of this.

All being said, Prolog is amazing, has a place in the future of programming, and gives you a level-up understanding of programming when you get how the types in every OO program is a Prolog program itself.

Re: Ask HN: What's Prolog like in 2024?

#53
You might be interested in reading about the Japanese "Fifth Generation Computer Systems" project from 1982, which revolved around PROLOG.

https://en.wikipedia.org/wiki/Fifth_Generation_Computer_Syst...

>The Fifth Generation Computer Systems (FGCS; Japanese: 第五世代コンピュータ, romanized: daigosedai konpyūta) was a 10-year initiative begun in 1982 by Japan's Ministry of International Trade and Industry (MITI) to create computers using massively parallel computing and logic programming. It aimed to create an "epoch-making computer" with supercomputer-like performance and to provide a platform for future developments in artificial intelligence. FGCS was ahead of its time, and its excessive ambitions led to commercial failure. However, on a theoretical level, the project spurred the development of concurrent logic programming.

>The term "fifth generation" was intended to convey the system as being advanced. In the history of computing hardware, there were four "generations" of computers. Computers using vacuum tubes were called the first generation; transistors and diodes, the second; integrated circuits, the third; and those using microprocessors, the fourth. Whereas previous computer generations had focused on increasing the number of logic elements in a single CPU, the fifth generation, it was widely believed at the time, would instead turn to massive numbers of CPUs to gain performance.

[...]

>Concurrent logic programming

>In 1982, during a visit to the ICOT, Ehud Shapiro invented Concurrent Prolog, a novel programming language that integrated logic programming and concurrent programming. Concurrent Prolog is a process oriented language, which embodies dataflow synchronization and guarded-command indeterminacy as its basic control mechanisms. Shapiro described the language in a Report marked as ICOT Technical Report 003,[7] which presented a Concurrent Prolog interpreter written in Prolog. Shapiro's work on Concurrent Prolog inspired a change in the direction of the FGCS from focusing on parallel implementation of Prolog to the focus on concurrent logic programming as the software foundation for the project.[3] It also inspired the concurrent logic programming language Guarded Horn Clauses (GHC) by Ueda, which was the basis of KL1, the programming language that was finally designed and implemented by the FGCS project as its core programming language.

>The FGCS project and its findings contributed greatly to the development of the concurrent logic programming field. The project produced a new generation of promising Japanese researchers.

https://www.sjsu.edu/faculty/watkins/5thgen.htm

>The Japanese Fifth Generation project was a collaborative effort of the Japanese computer industry coordinated by the Japanese Government that intended not only to update the hardware technology of computers but alleviate the problems of programming by creating AI operating systems that would ferret out what the user wanted and then do it. The Project chose to use PROLOG as the computer language for the AI programming instead of the LISP-based programming of the American AI researchers.

The Japanese National Fifth Generation Project: Introduction, survey, and evaluation:

https://stacks.stanford.edu/file/druid:kv359wz9060/kv359wz90...

>Abstract:

Projecting a great vision of intelligent systems in the service of the economy and society, the Japanese government in 1982 launched the national Fifth Generation Computer Systems (FGCS) project. The project was carried out by a central research institute, ICOT, with personnel from its member-owners, the Japanese computer manufacturers (JCMs) and other electronics industry firms. The project was planned for ten years, but continues through year eleven and beyond. ICOT chose to focus its efforts on language issues and programming methods for logic programming, supported by special hardware. Sequential 'inference machines' (PSI) and parallel 'inference machines' (PIM) were built. Performances of the hardware-software hybrid was measured in the range planned (150 million logical inferences per second). An excellent system for logic programming on parallel machines was constructed (XLI). However, applicationswere done in demonstration form only (not deployed). The lack of a stream of applications that computer customers found effective and the sole use of a language outside the mainstream, Prolog, led to disenchantment among the JCMs.

Japan's Fifth Generation Computer Systems: Success or Failure?

https://www.reddit.com/r/prolog/comments/owb0xg/japans_fifth...

https://instadeq.com/blog/posts/japans-fifth-generation-comp...

>This post is a summary of content from papers covering the topic, it's mostly quotes from the papers from 1983, 1993 and 1997 with some edition, references to the present and future depend on the paper but should be easy to deduce. See the Sources section at the end.

[...]

>Prolog vs LISP

>Achieving such revolutionary goals would seem to require revolutionary techniques. Conventional programming languages, particularly those common in the late 1970s and early 1980s offered little leverage.

>The requirements clearly suggested the use of a rich, symbolic programming language capable of supporting a broad spectrum of programming styles.

>Two candidates existed: LISP which was the mainstream language of the US Artificial Intelligence community and Prolog which had a dedicated following in Europe.

>LISP had been used extensively as a systems programming language and had a tradition of carrying with it a featureful programming environment; it also had already become a large and somewhat messy system. Prolog, in contrast, was small and clean, but lacked any experience as an implementation language for operating systems or programming environments. [...]

>Fun Trivia

>The one commercial use we saw of the PSI machines was at Japan Air Lines, where the PSI-II machines were employed; ironically, they were remicrocoded as Lisp Machines.

Re: Ask HN: What's Prolog like in 2024?

#54

The problem with Prolog is that it's based on unification, and small unification engines can be expressed in a few lines in any functional programming language. That narrows down the already small niche where one would choose Prolog by probably a few orders.

Is this in the same sense that "one could write lisp in 99 lines of c"? In my opinion, this does not imply that proper lisp (and correspondingly prolog) implementations are useless, just because a simple implementation can be written in a different, "more expressive" language.

No, not really. A lisp in 99 lines of C would barely be useful. In contrast, Prolog mostly shines where you need reasoning/unification over a database of facts -happens pretty often,- but that's just too easily expressed in any proper functional language. And with a bit more pain in an imperative/OO language.

Re: Ask HN: What's Prolog like in 2024?

#55
Tangent to Prolog, perhaps check Flix, which includes logic programming features [1], and is discussed here from time to time [2].

--

1: https://doc.flix.dev/fixpoints.html

2: https://news.ycombinator.com/item?id=25513397

2: https://news.ycombinator.com/item?id=31448889

2: https://news.ycombinator.com/item?id=38419263

Re: Ask HN: What's Prolog like in 2024?

#56

Not sure about Prolog itself but Datalog really needs to overtake SQL, it's just so much better. Related areas like constraint programming are still very relevant.

Are there any production ready open source databases using it?

Datomic uses Datalog with a weird clojure syntax instead of the usual prolog-like syntax.

Re: Ask HN: What's Prolog like in 2024?

#58
post #14

Prolog has reached an exciting new milestone with Scryer prolog. It is the first highly performant open source iso-compliant Prolog. I would check out Markus Triska's work to have your mind blown: https://www.metalevel.at/prolog https://youtube.com/@thepowerofprolog

I interviewed and helped hire Mark Thom, the original author of Scryer. I also follow Scryer with interest, even though most of my limited Prolog use has been with SWI Prolog (and one large project with ExperProlog in the 1980s).

One thing to check out: Prolog plays fairly well with Python, providing opportunities for hybrid projects.

Re: Ask HN: What's Prolog like in 2024?

#59
post #23

Shameless plug: you should check out my podcast The Search Space for a view of the broader landscape of Prolog and logic programming: https://thesearch.space/ I don't publish episodes often but I have a lot of good interviewees lined up :) In general, I would advice you to look beyond Prolog and explore Answer Set Programming, the Picat language, and the connections between logic programming and databases (SQL, RDF o…

Good to know there is further content lined up! I’m subscribed and eagerly waiting for it!

Re: Ask HN: What's Prolog like in 2024?

#60

Earlier quoted context omitted.

Datomic uses Datalog with a weird clojure syntax instead of the usual prolog-like syntax.

Not open source though?

Hmm open source I'm not sure, there are many SQLite equivalents listed on wikipedia though, if that counts.
Post reply on HN