Why in 2020 should I learn Prolog?

I’m going to take your statement out of context on purpose just so I can make a point :slight_smile: 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?

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.

1 Like

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

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?

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.

1 Like

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!

2 Likes

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

1 Like

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”.

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).

If only more programmers would learn and embrace different programming paradigms.

To reinforce the self improvement as I noted

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

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:

and the details of its semantics and look for deeper connections (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

I think of those as a 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

1 Like

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

Absolutely agree! Lisp and Prolog are mind bending!! :smiley:

2 Likes

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).
7 Likes

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)

Although it’d probably be easier to write a Prolog version from one of the Eliza “clones” or from Emacs doctor.

This post has been noted on Hacker News.

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.

I assumed it is a wink at the Lisp quote:

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

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

The closest I’ve found to that quote is from Paul Graham who described Lisp in a blog post 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.

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