<?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>rlucas.net: The Next Generation &#187; prolog</title>
	<atom:link href="http://blog.rlucas.net/tag/prolog/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rlucas.net</link>
	<description>...fighting entropy one financing round at a time</description>
	<lastBuildDate>Sat, 04 Sep 2010 01:45:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The &#8220;user&#8221; virtual file / workspace in Prolog.</title>
		<link>http://blog.rlucas.net/uncategorized/the-user-virtual-file-workspace-in-prolog/</link>
		<comments>http://blog.rlucas.net/uncategorized/the-user-virtual-file-workspace-in-prolog/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 19:35:00 +0000</pubDate>
		<dc:creator>rlucas</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[prolog]]></category>
		<category><![CDATA[propaedeutics]]></category>

		<guid isPermaLink="false">http://blog.rlucas.net/?p=397</guid>
		<description><![CDATA[When you&#8217;re first learning about Prolog, sometimes you&#8217;ll read books or tutorials that show you typing in &#8220;clauses,&#8221; and then immediately thereafter typing a &#8220;query.&#8221; If you use a visual or browser-based Prolog implementation, you&#8217;ll discover that there are two &#8220;modes&#8221; (my term), one for the input of the program / database, and one for [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re first learning about Prolog, sometimes you&#8217;ll read books or tutorials that show you typing in &#8220;clauses,&#8221; and then immediately thereafter typing a &#8220;query.&#8221;  If you use a visual or browser-based Prolog implementation, you&#8217;ll discover that there are two &#8220;modes&#8221; (my term), one for the input of the program / database, and one for querying.  The query form is denoted by the prompt &#8220;?-&#8221; as in:<br />
<code><br />
?- my_query_(Variable).</code></p>
<p>To me, it was somewhat confusing as to why and how I had to keep separate my program from my queries, since I was used to REPL-type interactive programming (e.g. irb for Ruby).</p>
<p>Later, in reading the SWI-Prolog manual, I saw reference to this odd snippet in the &#8220;<a href="http://www.swi-prolog.org/pldoc/doc_for?object=section%282%2c%20%274.27%27%2c%20swi%28%27%2fdoc%2fManual%2fextendarith.html%27%29%29">Adding Arithmetic Functions</a>&#8221; section:</p>
<p><code>?- [user].</p>
<p>:- other_stuff(x).</code><br />
&#8230;</p>
<p>It appeared that [user] was changing the mode from query-mode to program-mode, and allowing me to define new predicates.</p>
<p>Well, close.  It turns out the way to think about this (can&#8217;t seem to find it in the SWI-Prolog manual) is that the square-bracket notation is the &#8220;load file&#8221; shortcut, and Prolog comes with a virtual file known as &#8220;user.&#8221;  When you query:</p>
<p><code>?- [user].</code></p>
<p>and then go on to get:</p>
<p><code>|:</code></p>
<p>as your new prompt, you&#8217;re loading the &#8220;user&#8221; file which is like opening a handle on STDIN.  (Not precisely, but close enough.)  You can then type your program entries, /but you must terminate them with EOF/ (ctrl-D).</p>
<p>This bit of prerequisite knowledge would have saved me a lot of puzzlement and trial-and-error.  A shame that Prolog, despite a nearly 40-year history of continuous use and usefulness, has such a high propaedeutic load.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rlucas.net/uncategorized/the-user-virtual-file-workspace-in-prolog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWI-Prolog from MacPorts on OS X 10.5</title>
		<link>http://blog.rlucas.net/bugfix/swi-prolog-from-macports-on-os-x-10-5/</link>
		<comments>http://blog.rlucas.net/bugfix/swi-prolog-from-macports-on-os-x-10-5/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 00:05:42 +0000</pubDate>
		<dc:creator>rlucas</dc:creator>
				<category><![CDATA[bugfix]]></category>
		<category><![CDATA[geekery]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[prolog]]></category>

		<guid isPermaLink="false">http://blog.rlucas.net/?p=389</guid>
		<description><![CDATA[Tried installing the binary of SWI-Prolog (swi-prolog-5.8.2-leopard-intel.mpkg) on my Mac OS X 10.5 box.  For whatever reason, it was bombing out with some nasty errors (Libary not loaded &#8230; image not found).  Read about others&#8217; troubles and decided to try MacPorts.  Couldn&#8217;t get SWI-Prolog to install using a standard: $ sudo port -v install swi-prolog [...]]]></description>
			<content:encoded><![CDATA[<p>Tried installing the binary of SWI-Prolog (swi-prolog-5.8.2-leopard-intel.mpkg) on my Mac OS X 10.5 box.  For whatever reason, it was bombing out with some nasty errors (Libary not loaded &#8230; image not found).  Read about others&#8217; troubles and decided to try MacPorts.  Couldn&#8217;t get SWI-Prolog to install using a standard:</p>
<pre>$ sudo port -v install swi-prolog</pre>
<p>Ended up getting lots of BS errors on the lines of &#8220;ERROR: Could not load/find library -lXpm.&#8221;</p>
<pre>*****************************************************************
* ERROR: Could not load/find library -lXpm.         *
* Please install the XPM library and rerun configure.       *
* The primary source for libXpm is at:              *
*                               *
*     http://www-sop.inria.fr/koala/lehors/xpm.html     *
*                               *
* NOTE: If your system has libXpm, check the following:     *
*                               *
*   - Do you have the development version of the library?   *
*   - Is the library you have of the right architecture?    *
*   - Could it be that other parts of X11 are missing?  *
*     (typically the case if -lXext is also missing)    *
*                               *
*   Examine packages/xpce/src/config.log for details    *
*   Linux users: check README.debian for dependencies   *
*   (note that the exact package names vary between     *
*   distributions).                     *
*****************************************************************</pre>
<p>Long story short: For various reasons, the MacPorts installed software wasn&#8217;t finding my Apple Developer X11 libraries, and it also wasn&#8217;t appropriately requiring the software as dependencies for the swi-prolog package.  Had to do the following:</p>
<pre>$ sudo port -v install xpm</pre>
<pre>$ sudo port -v install xorg-libXt</pre>
<pre>$ sudo port -v install Xft2</pre>
<p>to get the prereqs installed (warning: those libs, in turn, have some mongo big dependencies, like Perl itself, so be ready for some serious compiling).  After that, installing swi-prolog worked just fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rlucas.net/bugfix/swi-prolog-from-macports-on-os-x-10-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->