<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>prolog Archives - ClickedyClick</title>
	<atom:link href="https://gergely.imreh.net/blog/tag/prolog/feed/" rel="self" type="application/rss+xml" />
	<link>https://gergely.imreh.net/blog/tag/prolog/</link>
	<description>Life in real, complex and digital.</description>
	<lastBuildDate>Wed, 07 Sep 2011 09:39:12 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Language of the Month: Prolog, part 2</title>
		<link>https://gergely.imreh.net/blog/2011/09/language-of-the-month-prolog-part-2/</link>
					<comments>https://gergely.imreh.net/blog/2011/09/language-of-the-month-prolog-part-2/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 09:38:50 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[lotm]]></category>
		<category><![CDATA[prolog]]></category>
		<guid isPermaLink="false">http://gergely.imreh.net/blog/?p=451</guid>

					<description><![CDATA[<p>If something, then this is a belated post. Prolog was the language of July and now it&#8217;s September. Anyway, before I completely fail, let&#8217;s just wrap it up and go on the next language with this one month hiatus in August. I really enjoyed the language and one month is indeed barely enough to start [&#8230;]</p>
<p>The post <a href="https://gergely.imreh.net/blog/2011/09/language-of-the-month-prolog-part-2/">Language of the Month: Prolog, part 2</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If something, then this is a belated post. Prolog was the <a title="Language of the Month: Prolog" href="http://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/" target="_blank">language of July</a> and now it&#8217;s September. Anyway, before I completely fail, let&#8217;s just wrap it up and go on the next language with this one month hiatus in August.</p>
<p>I really enjoyed the language and one month is indeed barely enough to start doing something useful. So I have to come back to it again and maybe keep reading about it in the meantime. It&#8217;s actually quite interesting to try to figure out Prolog code on paper, without actually running something. I think one of the books I was reading had plenty of exercises like this: <em>without running the code</em>, can you guess what is it doing? Needless to say, there were plenty of tricky bits/</p>
<h2>From the comments</h2>
<p>During two months, some additional resources did show up. A dear commenter on the previous post recommended me the following book: <a title="The Craft of Prolog on Goodreads" href="http://www.goodreads.com/book/show/3062424-the-craft-of-prolog" target="_blank">Richard O&#8217;Keefe: The Craft of Prolog</a>. I got about a third, maybe halfway through it and it&#8217;s interesting, written long time ago in a style that since gone out of fashion, unfortunately. It&#8217;s a programming book that is fun to read and one can see that the author is very knowledgeable. Some aspects of the book didn&#8217;t age very well, though. The author keeps comparing Prolog to other languages &#8211; many of them are not very widely available either. Also, some of the language features are specific to his version of Prolog, that wasn&#8217;t the same one I was using. Would recommend, though!</p>
<p>This last part, the different implementations of the same language, can be a real problem. Of the three compilers available for me, all of them had specific strengths and weaknesses. Guess they are converging, but not quite yet. So far I was mostly using <a title="SWI Prolog homepage" href="http://www.swi-prolog.org/" target="_blank">SWI Prolog</a>, but this might change in the future.</p>
<p>The said commenter also recommended a cross-compiler, doing Prolog-to-C magic, for portability and other goodness. Can grab it from here: <a title="Prolog to C compiler" href="http://ftp.shaw.ca/irvinsh/prolog.tar.gz" target="_blank">http://ftp.shaw.ca/irvinsh/prolog.tar.gz</a> I haven&#8217;t had time to try it yet, but once I have, I&#8217;ll do a comparison.</p>
<h2>From the web</h2>
<p>From a friend&#8217;s recommendation I was checking out <a title="Bookboon homepage" href="http://bookboon.com/uk/" target="_blank">a site with free textbooks</a>. They are all advertisement-sponsored, which is an intriguing idea (for another post). The <a title="Bookboon - IT and Programming" href="http://bookboon.com/uk/textbooks/it-programming" target="_blank">IT section</a> had not one but two books on Prolog: <a title="Book - Prolog Techniques" href="http://bookboon.com/uk/textbooks/it-programming/prolog-techniques-applications-of-prolog" target="_blank">Prolog Techniques</a> and <a title="Book - Applications of Prolog" href="http://bookboon.com/uk/textbooks/it-programming/applications-of-prolog" target="_blank">Applications of Prolog</a>.</p>
<figure id="attachment_492" aria-describedby="caption-attachment-492" style="width: 420px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/wp-content/uploads/2011/08/prolog_books.jpg"><img fetchpriority="high" decoding="async" class="size-full wp-image-492" title="Prolog book covers" src="http://gergely.imreh.net/blog/wp-content/uploads/2011/08/prolog_books.jpg" alt="Two prolog book covers" width="420" height="297" /></a><figcaption id="caption-attachment-492" class="wp-caption-text">Free textbooks on Prolog from Bookboon</figcaption></figure>
<p>This latter one has a Hungarian author so I&#8217;m even more intrigued, we used to have great computer scientists (<a title="John von Neumann on Wikipedia" href="http://en.wikipedia.org/wiki/Von_Neumann" target="_blank">John von Neumann / Neumann János</a>, anyone?), so I hope we keep up that tradition. (Oh, yeah, and had great physicists as well, maybe I can do more on that front later).</p>
<p>I was only skimmed them a little bit, but looks like these will be good addition for my &#8220;programming for fun and efficiency&#8221; library.</p>
<p>Will update the original <a title="Language of the Month: Prolog" href="http://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/" target="_blank">LotM:Prolog</a> page with these links as well. Now onto September&#8217;s Language, fortunately I have idea what I want to learn for the next ~3.5 weeks. October will be something Artificial Intelligence related since I signed up for the <a title="Stanford's Artificial Intelligence class" href="http://ai-class.com" target="_blank">AI-class.</a></p>
<p>The post <a href="https://gergely.imreh.net/blog/2011/09/language-of-the-month-prolog-part-2/">Language of the Month: Prolog, part 2</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2011/09/language-of-the-month-prolog-part-2/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Language of the Month: Prolog</title>
		<link>https://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/</link>
					<comments>https://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Sun, 17 Jul 2011 12:57:49 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[lotm]]></category>
		<category><![CDATA[prolog]]></category>
		<guid isPermaLink="false">http://gergely.imreh.net/blog/?p=413</guid>

					<description><![CDATA[<p>New month, new programming language to learn, the 3rd one in this series. So the repertoire so far contains: May: Scala June: Lua July: Prolog Prolog It is again a very different choice, logic programming. Been playing with it for the last two weeks or so, and it really makes me think differently about programming [&#8230;]</p>
<p>The post <a href="https://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/">Language of the Month: Prolog</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>New month, new programming language to learn, the 3rd one in this series. So the repertoire so far contains:</p>
<ul>
<li>May: <a title="Language of the Month: Scala" href="http://gergely.imreh.net/blog/2011/05/language-of-the-month-scala/" target="_blank">Scala</a></li>
<li>June: <a title="Language of the Month: Lua" href="http://gergely.imreh.net/blog/2011/06/language-of-the-month-lua/" target="_blank">Lua</a></li>
<li>July: Prolog</li>
</ul>
<h2>Prolog</h2>
<p>It is again a very different choice, logic programming. Been playing with it for the last two weeks or so, and it really makes me think differently about programming and programs. Logic and complex thinking was always a favorite past-time of me (e.g. solving puzzles and such), but only now I realized that I do have a lot to practice in this area.</p>
<p>Prolog is also one of the older languages (feels like a &#8220;classmate&#8221; of Lisp and Fortran) so it was the first language in the series where I could actually go to a library, take out some books to learn it, and that book wasn&#8217;t hopelessly out of date (try to do the same thing with Python or Ruby&#8230;). Since these books were also written by academics and not necessarily computer scientists, their whole approach is different, in a way more curious, though probably less practical.</p>
<p>In the end, I think what I would like to gain is a tool that I can use to attack problems that are intractable or at least very difficult in other languages.</p>
<h3>Start</h3>
<p>One of the first thing I found hard to figure out was how to actually run a program. So in a nutshell: even if most of the interaction is within an interpreter-like environment, all the basics have to be prepared in a file and loaded.</p>
<p>E.g. I prepare a file like this (based on Ender&#8217;s Game), call it <strong>ender.pl</strong>:</p>
<pre lang="prolog">%% Genealogy of Ender's Game.
% Facts
male(ender).
male(peter).
male('john paul').
female(valentine).
female(theresa).

parent('john paul', ender).
parent('john paul', peter).
parent('john paul', valentine).
parent(theresa, ender).
parent(theresa, peter).
parent(theresa, valentine).

% Predicates
father(X, Y) :-
	male(X),
	parent(X, Y).
mother(X, Y) :-
	female(X),
	parent(X, Y).

sibling(X, Y) :-
	father(F, X), mother(M, X),
	father(F, Y), mother(M, Y),
	X \= Y.
brother(X, Y) :-
	male(X),
	sibling(X, Y).
sister(X, Y) :-
	female(X),
	sibling(X, Y).</pre>
<p>Then starting Prolog I can load the file with the <strong>[&#8216;ender.pl&#8217;].</strong> form, and ask questions like who is Ender&#8217;s sister? Who are Theresa&#8217;s kids? Who are Peter&#8217;s siblings?</p>
<pre lang="Prolog">?- ['ender.pl'].
% ender.pl compiled 0.00 sec, 144 bytes
true.

?- sister(Sis, ender).
Sis = valentine ;
false.

?- mother(theresa, Kid).
Kid = ender ;
Kid = peter ;
Kid = valentine.

?- sibling(peter, X).
X = ender ;
X = valentine ;
false.</pre>
<p>Well, this is laughably simple, and I&#8217;m beyond this already, but it&#8217;s good for a first illustration.</p>
<p>By the way, it looks like 90% of elementary Prolog examples use family trees (Nordic or Greek gods, literary, real families&#8230;)</p>
<p>Now let&#8217;s get in there and learn some more stuff&#8230;</p>
<h2>Links</h2>
<h3>Tutorials &amp; Info</h3>
<ul>
<li><a title="A Short Tutorial on Prolog" href="http://www.doc.gold.ac.uk/~mas02gw/prolog_tutorial/prologpages/" target="_blank">A Short Tutorial on Prolog</a></li>
<li><a title="Adventure in Prolog homepage" href="http://www.amzi.com/AdventureInProlog/index.php" target="_blank">Adventure in Prolog</a></li>
<li><a title="Lecture 13 in the Lecture Series on Artificial Intelligence by Prof. P. Dasgupta, " href="http://www.youtube.com/watch?v=jySpg72Vbc4" target="_blank">Logic Programing lecture</a> and <a title="Lecture 14 in Lecture Series on Artificial Intelligence by Prof. P. Dasgupta" href="http://www.youtube.com/watch?v=iJhtgWAGUAQ" target="_blank">Prolog Programming</a> (videos)</li>
<li><a title="Prolog on Wikipedia" href="http://en.wikipedia.org/wiki/Prolog" target="_blank">Prolog on Wikipedia</a></li>
</ul>
<h3>Books</h3>
<ul>
<li><a title="The Art of Prolog book homepage" href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;tid=8327" target="_blank">The Art of Prolog</a></li>
</ul>
<h3>Compilers</h3>
<ul>
<li><a title="SWI Prolog homepage" href="http://www.swi-prolog.org/" target="_blank">SWI Prolog</a></li>
<li><a title="GNU Prolog homepage" href="http://www.gprolog.org/" target="_blank">GNU Prolog</a></li>
<li><a title="Yet Another Prolog homepage" href="http://www.dcc.fc.up.pt/~vsc/Yap/" target="_blank">Yet Another Prolog (YAP)</a></li>
</ul>
<h3>Code</h3>
<ul>
<li><a title="Solve Einstein’s Riddle using Prolog" href="http://www.baptiste-wicht.com/2010/09/solve-einsteins-riddle-using-prolog/" target="_blank">Einstein&#8217;s Riddle in Prolog</a></li>
</ul>
<p>The post <a href="https://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/">Language of the Month: Prolog</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2011/07/language-of-the-month-prolog/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 18/22 objects using APC
Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: gergely.imreh.net @ 2026-09-10 18:53:12 by W3 Total Cache
-->