Hi, lets talk about Prolog. 😊 Prolog is a logic programming language and has an important role in artificial intelligence. You can use it for collections of facts and rules which you can query. It describes facts and relationships. All the facts and rules are saved in one file.
On the picture you see example code, which I have taken from Derek Banas' Youtube tutorial, find the link at the end.
The fact says that Romeo loves Juliet. :-
defines a rule, so it is similar to the if statement. So the next line says that Juliet loves Romeo if Romeo loves Juliet.
Variables always start with an uppercase letter. We can use them to ask who loves Romeo for example, by entering loves(romeo, X).
in the terminal after we compiled the file with [filename].
All you need to get started with Prolog is a text editor and your command line. Save your Prolog file with .pl at the end. In the command line navigate to where you saved that file and enter swipl to start the compiler interface.
On Linux you can install a compiler for prolog like this:
sudo apt-get install swi-prolog
I tried to use the GNU-Prolog compiler but the version 1.4.5 seems to have a problem with :-
, so I use swi-prolog instead. Find the complete Prolog tutorial from Derek here:
https://www.youtube.com/watch?v=SykxWpFwMGs&t=1273s
What are you learning at the moment? Have a nice day! 😊
Top comments (2)
Hi Anja,
Have you ever tried R and RStudio for machine learning?
I use it daily. R is very powerful and open-source!
M :)
Hi Matt, yes we used R and R studio in our data science course at the Uni, it's nice! 😊 didn't utilize it for ML yet though.