# Why in 2020 should I learn Prolog?

**URL:** <https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080>\
**Category:** Help!\
**Created:** [March 31, 2020, 5:19am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080 "2020-03-31T05:19:05Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![bwat](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bwat](https://swi-prolog.discourse.group/u/bwat)\
**Post date:** [April 17, 2020, 10:24am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/21 "2020-04-17T10:24:05Z")

</div>

> [@emacstheviking](#):
>
> I realise that what I really needed all along was DCG-s and Prolog and nothing more!

I’m going to take your statement out of context on purpose just so I can make a point 🙂 Right, there is a problem with language exclusivity:

- If we need a new data structure we create a new library.
- If we need a new control structure we create a new language.

Prologians (and Lispers) are experts with meta-interpreters so the new language thing is easy. What I had drummed into my head was we shouldn’t use Prolog if we can create a language that is better. We were supposed to create languages like mathematicians create notations.

In the book Eco-Logic they develop a order sorted ‘Prolog’ with functions for ecological modelling. Once you see how easy it is to do taxonomical reasoning with order sorted logic and mathematical modelling with functions, there’s no going back to Prolog for that sort of thing. I implemented their language in 267 lines of well documented Prolog. I can add Prolog prdicates as built in predicates of this new language with one line - one line. Why would I use Prolog?

> [@emacstheviking](#):
>
> (a) why’d it take so long to “understand” and (b) why couldn’t I have learned Prolog 35 years ago!

Oh, I know the feeling. I was taught Prolog in the early 1990s but only really ‘got it’ when I implemented a WAM, compiler, debugger, and all that in around 2014. I always knew there was something to be gained from that type of programming but professional programming (pretty much all the languages you mention) got in the way.

---

<div class="post-metadata">

**Author:** ![emacstheviking](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/emacstheviking/32/228_2.png) [@emacstheviking](https://swi-prolog.discourse.group/u/emacstheviking)\
**Post date:** [April 17, 2020, 10:25am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/22 "2020-04-17T10:25:31Z")

</div>

> [@Boris](#):
>
> As is, experience shows that the only road to _that kind of understanding_ is just working on it with your own hands and head (whatever “it” really is…)

Spot on!! I never went to university so I never “heard” about it other than through my own self-learning, which never stops. 🙂

---

<div class="post-metadata">

**Author:** ![bwat](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bwat](https://swi-prolog.discourse.group/u/bwat)\
**Post date:** [April 17, 2020, 10:27am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/23 "2020-04-17T10:27:56Z")

</div>

> [@emacstheviking](#):
>
> Spot on!! I never went to university so I never “heard” about it other than through my own self-learning, which never stops. 🙂

That’s impressive. I could never have taught myself Prolog. I remember getting a lot of support from tutors at uni. How did you manage it on your own?

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 17, 2020, 10:28am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/24 "2020-04-17T10:28:59Z")

</div>

Programming languages are a strange thing. They are called “languages” just like real languages and this already is a problem. Programming languages are supposed to do so many conflicting things at the same time: tell a computer what to do, tell other people what the computer is apparently up to, help the programmer reason about what the computer is really doing, help multiple people together work on a problem _without losing efficiency_… the list goes on.

All in all I feel like such discussion always go in the same general direction because we (as in you me and whoever else is reading) have wildly different ideas of what a programming language is, what it is supposed to do, and also wildly different personal experiences with any given programming language.

---

<div class="post-metadata">

**Author:** ![emacstheviking](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/emacstheviking/32/228_2.png) [@emacstheviking](https://swi-prolog.discourse.group/u/emacstheviking)\
**Post date:** [April 17, 2020, 10:29am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/25 "2020-04-17T10:29:01Z")

</div>

> [@bwat](#):
>
> but professional programming (pretty much all the languages you mention) got in the way.

Don’t day jobs ruin everything…it’s the capitalist system holding us back. I can’t help thinking, aged 54 and a half, that money per se has done nothing but restrain and hinder development. Research is held back by “fear” of flying too close to anything other than things that guarantee funding, for example. Ego is a BIG problem. I also wonder why there isn’t more cross-pollination than there seems to be, for example “quantum biology” seems to be raising its heads in recent years but why oh why didn’t we appreciate that and dive into it 30 years ago? Maybe we did, like I say, I never went to uni. and am in no way connected to academia whatsoever. Much to my dismay but there you go!

---

<div class="post-metadata">

**Author:** ![emacstheviking](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/emacstheviking/32/228_2.png) [@emacstheviking](https://swi-prolog.discourse.group/u/emacstheviking)\
**Post date:** [April 17, 2020, 10:29am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/26 "2020-04-17T10:29:42Z")

</div>

That’s why I still maintain that software is art.

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 17, 2020, 10:31am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/27 "2020-04-17T10:31:06Z")

</div>

I also did not learn it at university. I heard of it at university so I knew it existed, but the goals of the lecture were in direct conflict with “learning Prolog”.

---

<div class="post-metadata">

**Author:** ![bwat](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bwat](https://swi-prolog.discourse.group/u/bwat)\
**Post date:** [April 17, 2020, 10:38am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/28 "2020-04-17T10:38:36Z")

</div>

> [@emacstheviking](#):
>
> > [@bwat](#):
> >
> > but professional programming (pretty much all the languages you mention) got in the way.
> 
> Don’t day jobs ruin everything…it’s the capitalist system holding us back. I can’t help thinking, aged 54 and a half, that money per se has done nothing but restrain and hinder development.

From a personal point of view I don’t expect ‘cultural development’ from the day job. I’m lucky enough to have a good amount of free time to devote to that sort of thing. Like a lot of posters in this thread have suggested, maybe people should learn Prolog in 2020 just for self improvement (think more logically and be better programmers in other languages).

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [April 17, 2020, 11:09am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/29 "2020-04-17T11:09:25Z")

</div>

> [@bwat](#):
>
> people should learn Prolog in 2020 just for self improvement (think more logically and be better programmers in other languages)

If only more programmers would learn and embrace different [programming paradigms](https://en.wikipedia.org/wiki/Programming_paradigm).

To reinforce the self improvement as I noted

> [@EricGT](#):
>
> the things you will learn about programming while on the path to learning how to use these concepts will open your eyes to many vistas few programmers ever see

just traveling the path is as important even if you find it was the wrong path. (Not implying Prolog is a wrong path but that any path can be a wrong path if you don’t know it is wrong before hand, thus the reason to learn and gain experience).

As you noted

> [@bwat](#):
>
> only really ‘got it’ when I implemented a WAM, compiler, debugger, and all that

just learning to program in a language will only take you so far. When one takes the time to understand the history of a language:

- imperative - [Turning paper](https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf)
- functional - [Church paper](https://pdfs.semanticscholar.org/28bf/123690205ae5bbd9f8c84b1330025e8476e4.pdf)
- reasoning (logic) - [Boole article](https://www.maths.tcd.ie/pub/HistMath/People/Boole/CalcLogic/CalcLogic.pdf)

and the details of its [semantics](https://en.wikipedia.org/wiki/Semantics) and look for deeper connections ([How are programming languages and foundations of mathematics related?](https://cs.stackexchange.com/questions/9756/how-are-programming-languages-and-foundations-of-mathematics-related)) do they start to see many more ways and simpler ways to solve problems.

In talking about Prolog as a language to create a new language to solve a problem, when thinking about Prolog I have come to think of it as that, but when I see

- [is/2](https://www.swi-prolog.org/pldoc/man?predicate=is/2)
- [Constraint Logic Programming](https://www.swi-prolog.org/pldoc/man?section=clp)
- [DCG](https://www.swi-prolog.org/pldoc/man?section=DCG),
- [quasi quotations](https://www.swi-prolog.org/pldoc/man?section=quasiquotations)  
and looking to learn
- [tabling](https://www.swi-prolog.org/pldoc/man?section=tabling)
- [s(CASP)](http://ceur-ws.org/Vol-2970/gdeinvited4.pdf)
- some of the [packages](https://www.swi-prolog.org/pack/list)

I think of those as a [domain specific language](https://en.wikipedia.org/wiki/Domain-specific_language) embedded in Prolog.

* * *

Here is a case in point that uses DCG and Constraint Logic Programming.

[Using Prolog to unravel the foundations of oncology dose-escalation trial designs](https://github.com/mthom/scryer-prolog/discussions/1136)

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [April 17, 2020, 11:55am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/30 "2020-04-17T11:55:43Z")

</div>

> [@emacstheviking](#):
>
> the full enormity of unification and back tracking

To add my 2 cents …

I may have had a similar / analogous experience when I wrote my first relational program – after many email exchanged with Markus Trishka, who helped me understand the significance of it.

I eventually, also noticed the computational cost that comes with this power, and eventually felt that Prolog should also explicitly enable deterministic – non-backtracking/non-choice point programming – mainly to achieve efficiencies where these are needed.

And, in certain application domains, again for efficiency sake, such as linked representations, to better enable pointer-oriented traversals rather than hash ones (which, i guess, could also co-exist with non-determinism).

Dan

---

<div class="post-metadata">

**Author:** ![emacstheviking](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/emacstheviking/32/228_2.png) [@emacstheviking](https://swi-prolog.discourse.group/u/emacstheviking)\
**Post date:** [April 17, 2020, 7:32pm UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/31 "2020-04-17T19:32:04Z")

</div>

> [@bwat](#):
>
> maybe people should learn Prolog in 2020 just for self improvement (think more logically and be better programmers in other languages).

Absolutely agree! Lisp and Prolog are mind bending!! 😃

---

<div class="post-metadata">

**Author:** ![labormarket](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/labormarket/32/975_2.png) [@labormarket](https://swi-prolog.discourse.group/u/labormarket)\
**Post date:** [April 18, 2020, 4:10pm UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/32 "2020-04-18T16:10:41Z")

</div>

In 1988 I started studying AI at University of Amsterdam. One of my lectures was Jan Wielemaker. I liked him as a teacher and human being. I was interested in the field of ‘modelling cognitive processes’ on computers. More specifically I was appealed by the concept of building knowledge based systems (my main study was to become a work and organizational psychologist and I wanted to build knowledge based systems based upon management decision rules).

So far, so good. In the course of my study I got stuck in all kinds of discussions I also recognize on this forum. Instead of teaching AI and Prolog, I first had to learn about computer architecture. Then I had to be learn programming skills, first Pascal then JAVA and finally in Prolog (never made it through).  
I was intrigued by offering people appealing interfaces that made sense. AI lectures stressed the importance of learning basis programming skills for ‘producing efficient source codes’ (to this day I think we both were right).

In 1992 I graduated in organizational psychology with a huge discussion between the company KLM and my lecturer on the theme that KLM evaluated my master to be excellent on the ground it was very useful in practice; university was less enthusiastic (to put in mildly) because my master did not meet ‘criteria of fundamental (basic) research’ (to this day I think we both were right).

This became ‘ the story of my life’ . Always in the middle of arguments where ‘practically applicable’ meet ‘scientifically approved’. ‘ theoretical approach is taught dissociated from a practical use’.

Prolog always stayed in the back of my mind. Now and then I would download DSWI Prolog and started to program as a hobby. But I always was disappointed on the absence of IDE. I wanted software where I could easily could draw some things like sliders and dependent graphs like JAVA and some software that easily executed lines of codes, again like JAVA.

In 2016 I developed a web based business concept in the field of labor market policies based on databases and decision making in algorithmic rules. I talked with software developers in JAVA, JAVASCRIPT (also React and angular), (my(SQL) and .Net. Everyone had their own arguments based upon their personal preferences. Confusing.

Then I remembered SWI Prolog. I focused on requirements I stated for my web based concept of ‘fuzzy matching’ of elements in the databases and the way knowledge rules are (elegant) stated in Prolog rather than ‘using endless if-then-else statements’. So, I dived into Visual Prolog, LPA prolog and SWI Prolog. Visual Prolog and LPA prolog have both invested in Visual IDE and Modeling.

With my, now partner drspro, we choose SWI Prolog (webbased, free and ‘community based). I like to end this comment with a few heart felt Prolog recommendation from my part:

1. Analyze this forum to draw conclusions on user/ programmer and user/ market demands. In a glimpse I see a need for good examples?
2. Discussions about ‘ learning curves’ are so 80’s. the average person responds far better to visual information compared to just plain ol’ text. Whether you’re buying a product or revising for an exam, visual stimulation over text translation allows the brain to consume the material with more consummate ease. We would much rather “relax” for 3 minutes and let the information flow over us by watching a video; enabling quick and easy consumption of the underlying message.
3. Start with a campaign website in line with the initiative from Anne Ogborn provides customers with an accessible and user-friendly way to show how they feel and to pass on comments and remarks.
4. SWI-Prolog is widely used in research and education as well as commercial applications. Publish A full list on the SWI website? Invite members of the SWI Prolog community for examples?
5. Develop a nice interface / IDE with a excellent editor. Get rid of the ?- command driven input and develop Visual Studio like interfaces.
6. Develop appealing applications based on community input. Like ELIZA has been referenced in popular culture and continues to be a source of inspiration for programmers and developers focused on artificial intelligence (explores Turing’s lifelong fascination with the interaction between humans and computers, pointing to ELIZA as one of the earliest realizations of Turing’s ideas).
7. Where is Prolog in applications for Robotics and artificial intelligence, deep learning, network analysis etc etc.
8. How put a lot of “knowledge” in data structures and use a small program using this data to do the job. Penetrate potential markets more actively and maybe aggressive. Where did students of AI/ Prolog go on their professional journey? Where are professionals occupied with ‘knowledge’ that can be stated in ‘knowledge rules’ and can be served by knowledge based systems like the promise was in de the ‘80’s and 90’s?
9. In the 90’s much effort was of the University of Amsterdam to built ‘shells’. What about shells to develop communications to help professionals state their knowledge in rules tot be implement in software?
10. Built a tool that allows experts to build decision models using a graphical paradigm, like MindMap/ LPA Prolog, but one that can be annotated using code and or Boolean logic and then executed and exported to other programs and processes.
11. Pros and Cons of Prolog against SQL, Java and the like with examples (on YouTube? ).
12. ‘How to’ instructive videos’ on YouTube (how to build knowledge in data, how to build a databased application in Prolog).

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [May 30, 2021, 5:05pm UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/33 "2021-05-30T17:05:46Z")

</div>

> [@labormarket](#):
>
> ELIZA has been referenced in popular culture and continues to be a source of inspiration for programmers and developers focused on artificial intelligence

The original ELIZA program has been found! (And it’s not written in LISP, but in a list-processing extension of an Algol-like language)

> **[ELIZAGEN](https://sites.google.com/view/elizagen-org)**
>
> The Genealogy of ELIZA

Although it’d probably be easier to write a Prolog version from one of the Eliza “clones” or from [Emacs doctor](https://www.emacswiki.org/emacs/EmacsDoctor).

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [November 27, 2021, 1:49pm UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/35 "2021-11-27T13:49:08Z")

</div>

This post has been noted on [Hacker News](https://news.ycombinator.com/item?id=29358933).

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [November 29, 2021, 9:44am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/37 "2021-11-29T09:44:37Z")

</div>

Do you have a source for this wonderful law (“Every programming language…”)? I’d like to share it with my students. If not, nevermind, then I will just refer to the message here.

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [November 29, 2021, 11:46am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/38 "2021-11-29T11:46:00Z")

</div>

I assumed it is a wink at the Lisp quote:

> **[Greenspun's tenth rule](https://en.m.wikipedia.org/wiki/Greenspun's_tenth_rule)**
>
> Greenspun's tenth rule of programming is an aphorism in computer programming and especially programming language circles that states:
> Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. The rule expresses the opinion that the argued flexibility and extensibility designed into the programming language Lisp includes all functionality that is theoretically needed to write any complex computer program, an...

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [November 29, 2021, 12:25pm UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/39 "2021-11-29T12:25:49Z")

</div>

…including Common Lisp, yes indeed, I’ve heard of that one.

Maybe one should try to rewrite swipl in Fortran, just to be sure…

---

<div class="post-metadata">

**Author:** ![joeblog](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/joeblog/32/122_2.png) [@joeblog](https://swi-prolog.discourse.group/u/joeblog)\
**Post date:** [November 29, 2021, 8:28pm UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/40 "2021-11-29T20:28:46Z")

</div>

The closest I’ve found to that quote is from Paul Graham who described Lisp in a [blog post](http://www.paulgraham.com/icad.html?viewfullsite=1) as “a kind of limit that mainstream languages are approaching asymptotically”.

I think that’s true in that all programming languages can be stripped down to abstract syntax trees, and learning a bit of Lisp helped me see the abstract syntax trees hidden within forests of syntactic sugar.

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [November 30, 2021, 7:47am UTC](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080/41 "2021-11-30T07:47:05Z")

</div>

Yes, the hubris of programmers from the “early days” is limitless.

[Previous page](https://swi-prolog.discourse.group/t/why-in-2020-should-i-learn-prolog/2080.md?page=1)
