<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-448</id>
	<title>Nabble - SWI Prolog</title>
	<updated>2009-11-26T05:37:59Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/SWI-Prolog-f448.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/SWI-Prolog-f448.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26529597</id>
	<title>Re: Critical bug in zlib library</title>
	<published>2009-11-26T05:37:59Z</published>
	<updated>2009-11-26T05:37:59Z</updated>
	<author>
		<name>Jan Wielemaker-3</name>
	</author>
	<content type="html">On Thursday 26 November 2009 02:27:07 pm Roberto Bagnara wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Jan Wielemaker wrote:
&lt;br&gt;&amp;gt; &amp;gt; On Tue, 2009-11-24 at 18:39 +0100, Roberto Bagnara wrote:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; We've found a critical bug in zlib library.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; The predicate test/0 above can be used to trigger the bug:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;lt;snip&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; pl is blocked in this infinite loop present in function zread
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; (zlib4pl.c):
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;while( (rc=gz_skip_footer(ctx)) == -2 )
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* TBD: read more */
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; The &amp;quot;To Be Done&amp;quot; marker seems to imply that the problem is known, but
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; we wonder if its importance has been underestimated.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Note that we have found this misbehaviour in a real application that
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; hangs unexpectedly reading gzipped files of unlucky size.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Thanks. &amp;nbsp;Fixed. &amp;nbsp;The patch has been merged into both pl-devel and pl.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks a lot Jan, this was really critical. &amp;nbsp;Another problem we have
&lt;br&gt;&amp;gt; is that SWI-Prolog's gzipped streams accept the `update' and `append'
&lt;br&gt;&amp;gt; open modes, but the implementation, last time I tried, did not seem
&lt;br&gt;&amp;gt; to be correct. &amp;nbsp;So the question is: are these open modes supported
&lt;br&gt;&amp;gt; now, or perhaps will they be supported soon?
&lt;/div&gt;&lt;br&gt;I see no trace of such things. I wouldn't even know what it means. You
&lt;br&gt;can't seek around in compressed files easily, so update? Append I guess
&lt;br&gt;should be technically possible, but it is certainly not on my priority
&lt;br&gt;list. If anything, it would be enumerating and opening .zip members.
&lt;br&gt;&lt;br&gt;So, not for me. &amp;nbsp;Of course, if someone extends the library, I'm happy to
&lt;br&gt;include the patches (don't forget the documentation!)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cheers --- Jan
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26529597&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Critical-bug-in-zlib-library-tp26500344p26529597.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26529450</id>
	<title>Re: Critical bug in zlib library</title>
	<published>2009-11-26T05:27:07Z</published>
	<updated>2009-11-26T05:27:07Z</updated>
	<author>
		<name>Roberto Bagnara</name>
	</author>
	<content type="html">Jan Wielemaker wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Tue, 2009-11-24 at 18:39 +0100, Roberto Bagnara wrote:
&lt;br&gt;&amp;gt;&amp;gt; We've found a critical bug in zlib library.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The predicate test/0 above can be used to trigger the bug:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;lt;snip&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; pl is blocked in this infinite loop present in function zread (zlib4pl.c):
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;while( (rc=gz_skip_footer(ctx)) == -2 )
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* TBD: read more */
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The &amp;quot;To Be Done&amp;quot; marker seems to imply that the problem is known, but
&lt;br&gt;&amp;gt;&amp;gt; we wonder if its importance has been underestimated.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Note that we have found this misbehaviour in a real application that
&lt;br&gt;&amp;gt;&amp;gt; hangs unexpectedly reading gzipped files of unlucky size.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Thanks. &amp;nbsp;Fixed. &amp;nbsp;The patch has been merged into both pl-devel and pl.
&lt;/div&gt;&lt;br&gt;Thanks a lot Jan, this was really critical. &amp;nbsp;Another problem we have
&lt;br&gt;is that SWI-Prolog's gzipped streams accept the `update' and `append'
&lt;br&gt;open modes, but the implementation, last time I tried, did not seem
&lt;br&gt;to be correct. &amp;nbsp;So the question is: are these open modes supported
&lt;br&gt;now, or perhaps will they be supported soon?
&lt;br&gt;Cheers,
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Roberto
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Prof. Roberto Bagnara
&lt;br&gt;Applied Formal Methods Laboratory
&lt;br&gt;Department of Mathematics, University of Parma, Italy
&lt;br&gt;&lt;a href=&quot;http://www.cs.unipr.it/~bagnara/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.unipr.it/~bagnara/&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26529450&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bagnara@...&lt;/a&gt;
&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26529450&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Critical-bug-in-zlib-library-tp26500344p26529450.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26526728</id>
	<title>Re: Intercepting &lt;RETURN&gt;</title>
	<published>2009-11-26T01:36:01Z</published>
	<updated>2009-11-26T01:36:01Z</updated>
	<author>
		<name>Jan Wielemaker-3</name>
	</author>
	<content type="html">On Wednesday 25 November 2009 11:40:56 pm bharat411 wrote:
&lt;br&gt;&amp;gt; Thanks, that works perfectly.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Any suggestions to prevent the program looping when the user closes SWI
&lt;br&gt;&amp;gt; while the program is running? It would help if you knew exactly what input
&lt;br&gt;&amp;gt; is supplied by SWI as part of it's exit routine, so that I could create a
&lt;br&gt;&amp;gt; rule to intercept this input. I just need to break or prevent the loop so
&lt;br&gt;&amp;gt; SWI can shut down properly.
&lt;br&gt;&lt;br&gt;Assuming we are talking about Windows, closing the window sends end-of-file
&lt;br&gt;to the console. &amp;nbsp;So, get0/1 binds its argument to -1.
&lt;br&gt;&lt;br&gt;P.s. instead of using the old get0/1, please us the ISO comliant get_code/1
&lt;br&gt;(which for the sake of this application does the same). &amp;nbsp;Other things to
&lt;br&gt;look at are read_line_to_codes/3 and maybe get_single_char/1.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cheers --- Jan
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Many Thanks
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bharat
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Torbjörn Lager-2 wrote:
&lt;br&gt;&amp;gt; &amp;gt; get0/1 might be what you are looking for, as in:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; ?- get0(C).
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; C = 10.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; ?- get0(C).
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; |: 1
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; C = 49.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; ?- get0(C).
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; |: 2
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; C = 50.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; - Torbjörn
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26526728&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Intercepting-%3CRETURN%3E-tp26519399p26526728.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26522221</id>
	<title>Re: subsumes/2 vs. subsumes_chk/2</title>
	<published>2009-11-25T15:32:23Z</published>
	<updated>2009-11-25T15:32:23Z</updated>
	<author>
		<name>Ulrich Neumerkel</name>
	</author>
	<content type="html">Bart Demoen:
&lt;br&gt;&lt;br&gt;&amp;gt;What is the optimality criterium?
&lt;br&gt;&amp;gt;... there is no broad view, just ad hoc examples.
&lt;br&gt;&lt;br&gt;Absolutely! &amp;nbsp;We need to start somehow!
&lt;br&gt;&lt;br&gt;Let's start from the intended uses. &amp;nbsp;As long as a loop checker uses
&lt;br&gt;subsumes_term/2 directly it is safe. &amp;nbsp;Should a constraint appear
&lt;br&gt;accidentally a clean error is produced. &amp;nbsp;A more sophisticated loop
&lt;br&gt;checker could now write:
&lt;br&gt;&lt;br&gt;&amp;nbsp; catch(subsumes_term(G,S), error(subsumption_error,_), Action)
&lt;br&gt;&lt;br&gt;where Action might be a safe default action (mostly probably failure).
&lt;br&gt;Or Action might be a much more sophisticated subsumption checker
&lt;br&gt;taking into account the meaning of the actual constraints involved.
&lt;br&gt;&lt;br&gt;In this manner loop checkers that do not handle constraints at all
&lt;br&gt;would be safe - they would receive an error should a constraint appear
&lt;br&gt;accidentally. &amp;nbsp;Loop checkers that do handle constraints get fast
&lt;br&gt;operation for the simple cases and would invoke Action for the complex
&lt;br&gt;ones.
&lt;br&gt;&lt;br&gt;So we want to maximize the number of cases handled directly by
&lt;br&gt;subsumes_term/2 - taking into account all legitimate uses of
&lt;br&gt;constraints. &amp;nbsp;This is tantamount to asking what does constitute a
&lt;br&gt;legitimate case.
&lt;br&gt;&lt;br&gt;Here is a case I do not consider legitimate:
&lt;br&gt;&lt;br&gt;?- freeze(Y, X = 1), subsumes_term_V1(X,2), ...
&lt;br&gt;&lt;br&gt;Since freeze/2 does not attach any information to X, subsumes_term/2
&lt;br&gt;cannot get that information at all. &amp;nbsp;Not too surprising as freeze/2 is
&lt;br&gt;somewhat the goto of constraints.
&lt;br&gt;&lt;br&gt;Even worse is:
&lt;br&gt;&lt;br&gt;?- freeze(Y, S = s(X)), subsumes_term_V1(X, S).
&lt;br&gt;&lt;br&gt;This case succeeds, because X does not contain any information about
&lt;br&gt;the freeze. &amp;nbsp;Ideally we would have a subsumption_error.
&lt;br&gt;&lt;br&gt;So only constraints that attach to all variables involved can be
&lt;br&gt;considered legitimate.
&lt;br&gt;&lt;br&gt;&amp;gt;subsumes_term_V1:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;% Problematic error:
&lt;br&gt;&amp;gt;% ?- dif(X,_), subsumes_term_V1(c,g(X)).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;I guess that you consider this problematic because there is no
&lt;br&gt;&amp;gt;instantiation of X for which this would not fail ?
&lt;br&gt;&lt;br&gt;Yes. &amp;nbsp;And this seems to be regardless of the constraint involved. &amp;nbsp;In
&lt;br&gt;this case even freeze(X, write(side_effect(X))) would silently fail.
&lt;br&gt;&lt;br&gt;&amp;gt;Or is it because dif(X,_) does not constrain X ?
&lt;br&gt;&lt;br&gt;Also, ... &amp;nbsp;But in general this second viewpoint depends on the actual
&lt;br&gt;constraints. &amp;nbsp;And we are currently interested to support the general
&lt;br&gt;case.
&lt;br&gt;&lt;br&gt;&amp;gt;[it actually does as long as the implementation of dif is not hidden:
&lt;br&gt;&amp;gt;one can get at the attributes of X and enforce that X becomes equal to
&lt;br&gt;&amp;gt;the _ - I know one isn't supposed to rely on being able to do that,
&lt;br&gt;&amp;gt;but ...]
&lt;br&gt;&lt;br&gt;We are in a twilight zone here. &amp;nbsp;For dif/2: We can observe dif(X,_) by
&lt;br&gt;the toplevel and the primitives it relies on, but I think in general
&lt;br&gt;we rather should consider both answers below as acceptable for dif.
&lt;br&gt;&lt;br&gt;?- dif(X,_).
&lt;br&gt;dif(X, _G405).
&lt;br&gt;&lt;br&gt;?- dif(X,_).
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;&amp;gt;{I can make similar arguments for rejecting 
&lt;br&gt;&amp;gt;% ?- dif(X,_), subsumes_term_V1(X,X).
&lt;br&gt;&amp;gt;as problematic}
&lt;br&gt;&lt;br&gt;How? &amp;nbsp;Here, X is identical. &amp;nbsp;X = X is not an event to trigger
&lt;br&gt;attributes at all.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt;% Problematic error:
&lt;br&gt;&amp;gt;% ?- dif(Y,a),subsumes_term_V5(X,Y).
&lt;br&gt;&amp;gt;% would work for dif/2. &amp;nbsp;But in general?
&lt;br&gt;&lt;br&gt;I am hesitating because of errors like
&lt;br&gt;&lt;br&gt;?- Y #&amp;gt; Z, Z #&amp;gt; Y, subsumes_term_V5(X, Y).
&lt;br&gt;&lt;br&gt;Shall they have any meaning? &amp;nbsp;The first two goals ideally should fail
&lt;br&gt;but the convention in constraint solvers is that inconsistencies are
&lt;br&gt;acceptable (as long as they remain visible in answers).
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/subsumes_term.pl&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/subsumes_term.pl&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26522221&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/subsumes-2-vs.-subsumes_chk-2-tp26147154p26522221.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26521532</id>
	<title>Re: Intercepting &lt;RETURN&gt;</title>
	<published>2009-11-25T14:40:55Z</published>
	<updated>2009-11-25T14:40:55Z</updated>
	<author>
		<name>bharat411</name>
	</author>
	<content type="html">Thanks, that works perfectly.
&lt;br&gt;&lt;br&gt;Any suggestions to prevent the program looping when the user closes SWI while the program is running? It would help if you knew exactly what input is supplied by SWI as part of it's exit routine, so that I could create a rule to intercept this input. I just need to break or prevent the loop so SWI can shut down properly.
&lt;br&gt;&lt;br&gt;Many Thanks
&lt;br&gt;&lt;br&gt;Bharat
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Torbjörn Lager-2 wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;get0/1 might be what you are looking for, as in:
&lt;br&gt;&lt;br&gt;?- get0(C).
&lt;br&gt;|:
&lt;br&gt;C = 10.
&lt;br&gt;&lt;br&gt;?- get0(C).
&lt;br&gt;|: 1
&lt;br&gt;&lt;br&gt;C = 49.
&lt;br&gt;&lt;br&gt;?- get0(C).
&lt;br&gt;|: 2
&lt;br&gt;&lt;br&gt;C = 50.
&lt;br&gt;&lt;br&gt;- Torbjörn
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Intercepting-%3CRETURN%3E-tp26519399p26521532.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26519748</id>
	<title>Re: Intercepting &lt;RETURN&gt;</title>
	<published>2009-11-25T12:26:14Z</published>
	<updated>2009-11-25T12:26:14Z</updated>
	<author>
		<name>Torbjörn Lager-2</name>
	</author>
	<content type="html">get0/1 might be what you are looking for, as in:
&lt;br&gt;&lt;br&gt;?- get0(C).
&lt;br&gt;|:
&lt;br&gt;C = 10.
&lt;br&gt;&lt;br&gt;?- get0(C).
&lt;br&gt;|: 1
&lt;br&gt;&lt;br&gt;C = 49.
&lt;br&gt;&lt;br&gt;?- get0(C).
&lt;br&gt;|: 2
&lt;br&gt;&lt;br&gt;C = 50.
&lt;br&gt;&lt;br&gt;- Torbjörn
&lt;br&gt;&lt;br&gt;On Wed, Nov 25, 2009 at 9:03 PM, bharat411 &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26519748&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bharat411@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm extremely new to SWI-Prolog, Prolog and this mailing list too =) So
&lt;br&gt;&amp;gt; forgive me if this question is a no-brainer (I couldn't find any solutions
&lt;br&gt;&amp;gt; by searching).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I was wondering if there was a way to intercept the &amp;lt;return&amp;gt; key pressed by
&lt;br&gt;&amp;gt; the user, i.e. wait for input, and if it's &amp;lt;return&amp;gt;, do something with it. I
&lt;br&gt;&amp;gt; know I can't use a blank character of some sort because SWI returns the
&lt;br&gt;&amp;gt; 'Unexpected end of clause' error. Any suggestions?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Secondly, my program works off a menu based system, and I have options 1
&lt;br&gt;&amp;gt; through 7 doing something, while entering anything other than these at the
&lt;br&gt;&amp;gt; prompt will output an error message and loop back to the menu. If a user
&lt;br&gt;&amp;gt; were to close SWI using the windows 'X' (top right) while the prompt was
&lt;br&gt;&amp;gt; waiting for input, the menu loop goes on infinitely and SWI doesn't close_______________________________________________
&lt;/div&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26519748&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Intercepting-%3CRETURN%3E-tp26519399p26519748.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26519399</id>
	<title>Intercepting &lt;RETURN&gt;</title>
	<published>2009-11-25T12:03:28Z</published>
	<updated>2009-11-25T12:03:28Z</updated>
	<author>
		<name>bharat411</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I'm extremely new to SWI-Prolog, Prolog and this mailing list too =) So forgive me if this question is a no-brainer (I couldn't find any solutions by searching).
&lt;br&gt;&lt;br&gt;I was wondering if there was a way to intercept the &amp;lt;return&amp;gt; key pressed by the user, i.e. wait for input, and if it's &amp;lt;return&amp;gt;, do something with it. I know I can't use a blank character of some sort because SWI returns the 'Unexpected end of clause' error. Any suggestions?
&lt;br&gt;&lt;br&gt;Secondly, my program works off a menu based system, and I have options 1 through 7 doing something, while entering anything other than these at the prompt will output an error message and loop back to the menu. If a user were to close SWI using the windows 'X' (top right) while the prompt was waiting for input, the menu loop goes on infinitely and SWI doesn't close. Any suggestions that don't involve removing the invalid input catcher?
&lt;br&gt;&lt;br&gt;Thanks a ton!</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Intercepting-%3CRETURN%3E-tp26519399p26519399.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26519029</id>
	<title>Re: Critical bug in zlib library</title>
	<published>2009-11-25T11:37:50Z</published>
	<updated>2009-11-25T11:37:50Z</updated>
	<author>
		<name>Jan Wielemaker-3</name>
	</author>
	<content type="html">On Tue, 2009-11-24 at 18:39 +0100, Roberto Bagnara wrote:
&lt;br&gt;&amp;gt; We've found a critical bug in zlib library.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The predicate test/0 above can be used to trigger the bug:
&lt;br&gt;&lt;br&gt;&amp;lt;snip&amp;gt;
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; pl is blocked in this infinite loop present in function zread (zlib4pl.c):
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;while( (rc=gz_skip_footer(ctx)) == -2 )
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* TBD: read more */
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The &amp;quot;To Be Done&amp;quot; marker seems to imply that the problem is known, but
&lt;br&gt;&amp;gt; we wonder if its importance has been underestimated.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Note that we have found this misbehaviour in a real application that
&lt;br&gt;&amp;gt; hangs unexpectedly reading gzipped files of unlucky size.
&lt;/div&gt;&lt;br&gt;Thanks. &amp;nbsp;Fixed. &amp;nbsp;The patch has been merged into both pl-devel and pl.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cheers --- Jan
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26519029&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Critical-bug-in-zlib-library-tp26500344p26519029.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26517533</id>
	<title>CHR: optimization takes forever</title>
	<published>2009-11-25T09:58:57Z</published>
	<updated>2009-11-25T09:58:57Z</updated>
	<author>
		<name>Gleb Alexeyev</name>
	</author>
	<content type="html">Hello!
&lt;br&gt;&lt;br&gt;Here's the test program that compiles ~ 13 seconds on my machine:
&lt;br&gt;&lt;br&gt;:- use_module(library(chr)).
&lt;br&gt;:- chr_option(debug, off).
&lt;br&gt;:- chr_option(optimize, full).
&lt;br&gt;&lt;br&gt;:- chr_constraint baz/3, bar/2, foo/2, quux/2.
&lt;br&gt;&lt;br&gt;foo(R, RH), foo(A1, AH1), foo(A2, AH2),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; baz(_, GR, RH), bar(GR, PR),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; baz(_, GA1, AH1), bar(GA1, PA1),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; baz(_, GA2, AH2), bar(GA2, PA2),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; quux(R, A1) \ quux(R, A2) &amp;lt;=&amp;gt; PR == PA1, PR \== PA2 | true.
&lt;br&gt;&lt;br&gt;&lt;br&gt;If I duplicate the only rule in the program, compilation takes forever.
&lt;br&gt;Thus the question: what is time complexity of CHR optimizer? Is the test 
&lt;br&gt;program illegal in any way?
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26517533&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/CHR%3A-optimization-takes-forever-tp26517533p26517533.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26516737</id>
	<title>Re: compiling a file into its variants at once on the fly</title>
	<published>2009-11-25T09:15:05Z</published>
	<updated>2009-11-25T09:15:05Z</updated>
	<author>
		<name>Kuniaki Mukai</name>
	</author>
	<content type="html">Hi Jan,
&lt;br&gt;&lt;br&gt;&amp;gt; Note that modules are loaded only once.
&lt;br&gt;&lt;br&gt;Thank you for this clear answer. Now I understand it. 
&lt;br&gt;&lt;br&gt;&amp;gt; You can do such tricks using :- include/1.
&lt;br&gt;&lt;br&gt;Replacing &amp;nbsp; use_module/1 in my examples with include/1 has resulted
&lt;br&gt;exactly what I want. &amp;nbsp;It is very simple, and works beautifully. 
&lt;br&gt;Many thanks.
&lt;br&gt;&lt;br&gt;&lt;br&gt;(a modified version for using inlcude/1)
&lt;br&gt;&lt;br&gt;%%% file: b.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-if(nb_getval(flag, true)).
&lt;br&gt;d(0).
&lt;br&gt;:-else.
&lt;br&gt;d(1).
&lt;br&gt;:- endif.
&lt;br&gt;%%% end of file %%%%%%
&lt;br&gt;&lt;br&gt;%%% &amp;nbsp;module file: &amp;nbsp;a1.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-module(a1,[]).
&lt;br&gt;:-include(b).
&lt;br&gt;%%% end of file %%%%%%
&lt;br&gt;&lt;br&gt;%%% module file: a2.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-module(a2,[]).
&lt;br&gt;:-include(b).
&lt;br&gt;%%% end of file %%%%%%
&lt;br&gt;&lt;br&gt;%%% &amp;nbsp;main.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-nb_setval(flag, true), use_module(a1).
&lt;br&gt;:-nb_setval(flag, false), use_module(a2).
&lt;br&gt;%%% end of file &amp;nbsp; &amp;nbsp;%%%%%%
&lt;br&gt;&lt;br&gt;?- [main].
&lt;br&gt;?- % &amp;nbsp;a1 compiled into a1 0.00 sec, 1,584 bytes
&lt;br&gt;% &amp;nbsp;a2 compiled into a2 0.00 sec, 1,224 bytes
&lt;br&gt;% /Users/cantor/tmp/main.pl compiled 0.00 sec, 4,400 bytes
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;?- a1:d(X).
&lt;br&gt;X = 0.
&lt;br&gt;&lt;br&gt;?- a2:d(X).
&lt;br&gt;X = 1.
&lt;br&gt;&lt;br&gt;Kuniaki
&lt;br&gt;&lt;br&gt;&lt;br&gt;?- 
&lt;br&gt;&lt;br&gt;On Nov 26, 2009, at 1:26 AM, Jan Wielemaker wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi Kuniaki,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Note that modules are loaded only once. So, for the two references to
&lt;br&gt;&amp;gt; reexport(b, []), only the first does something. The second is a simple
&lt;br&gt;&amp;gt; no-op. You force the module to be reloaded using load_files/2, but you
&lt;br&gt;&amp;gt; will always get the same result for a1:d(X) and a2:d(X) because they
&lt;br&gt;&amp;gt; both export from the same module and there is always only one instance
&lt;br&gt;&amp;gt; of that module. I.e. a reload will wipe b and then load the new
&lt;br&gt;&amp;gt; definitions into it.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You can do such tricks using :- include/1. That loads the text verbatim
&lt;br&gt;&amp;gt; into the module in which the directive appears, clausing all predicates
&lt;br&gt;&amp;gt; and definitions that appear in them to exist multiple times.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	Cheers --- Jan
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Wednesday 25 November 2009 04:59:19 pm Kuniaki Mukai wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; Preparing four tiny files below, I expected
&lt;br&gt;&amp;gt;&amp;gt; the following results.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- [main].
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- a1:d(X).
&lt;br&gt;&amp;gt;&amp;gt; X = 0.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- a2:d(X).
&lt;br&gt;&amp;gt;&amp;gt; X = 1.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; However, as log below shows, it is &amp;nbsp;not the case.
&lt;br&gt;&amp;gt;&amp;gt; Although I read &amp;nbsp;the help on &amp;nbsp;module at least twice,
&lt;br&gt;&amp;gt;&amp;gt; I could not point out myself what is wrong with the code below.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; What I want to do actually is to compile a file
&lt;br&gt;&amp;gt;&amp;gt; into its (two) variants at once by switching parameters
&lt;br&gt;&amp;gt;&amp;gt; on the fly.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; Thank &amp;nbsp;you in advance for any hint.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% module file: b.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; :- module(b,[]).
&lt;br&gt;&amp;gt;&amp;gt; :-if(nb_getval(flag, true)).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; d(0).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; :-else.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; d(1).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; :- endif.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% end of file %%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% &amp;nbsp;module file: &amp;nbsp;a1.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; :-module(a1,[]).
&lt;br&gt;&amp;gt;&amp;gt; :-reexport(b, []).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% end of file %%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% module file: a2.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; :-module(a2,[]).
&lt;br&gt;&amp;gt;&amp;gt; :-reexport(b, []).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% end of file %%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% &amp;nbsp;main.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; :-nb_setval(flag, true), use_module(a1).
&lt;br&gt;&amp;gt;&amp;gt; :-nb_setval(flag, false), use_module(a2).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%% end of file &amp;nbsp; &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; %%%
&lt;br&gt;&amp;gt;&amp;gt; Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 5.8.1-4-ge648422)
&lt;br&gt;&amp;gt;&amp;gt; Copyright (c) 1990-2009 University of Amsterdam.
&lt;br&gt;&amp;gt;&amp;gt; SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
&lt;br&gt;&amp;gt;&amp;gt; and you are welcome to redistribute it under certain conditions.
&lt;br&gt;&amp;gt;&amp;gt; Please visit &lt;a href=&quot;http://www.swi-prolog.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.swi-prolog.org&lt;/a&gt;&amp;nbsp;for details.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; For help, use ?- help(Topic). or ?- apropos(Word).
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- [main].
&lt;br&gt;&amp;gt;&amp;gt; % &amp;nbsp; b compiled into b 0.00 sec, 968 bytes
&lt;br&gt;&amp;gt;&amp;gt; % &amp;nbsp;a1 compiled into a1 0.00 sec, 2,144 bytes
&lt;br&gt;&amp;gt;&amp;gt; % &amp;nbsp;a2 compiled into a2 0.00 sec, 832 bytes
&lt;br&gt;&amp;gt;&amp;gt; % main compiled 0.00 sec, 4,728 bytes
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- a1:d(X).
&lt;br&gt;&amp;gt;&amp;gt; Correct to: &amp;quot;b:d(X)&amp;quot;? y
&lt;br&gt;&amp;gt;&amp;gt; X = 0.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- a2:d(X).
&lt;br&gt;&amp;gt;&amp;gt; Correct to: &amp;quot;b:d(X)&amp;quot;? y
&lt;br&gt;&amp;gt;&amp;gt; X = 0.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- listing.
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- current_module(X).
&lt;br&gt;&amp;gt;&amp;gt; X = user ;
&lt;br&gt;&amp;gt;&amp;gt; X = error ;
&lt;br&gt;&amp;gt;&amp;gt; X = lists ;
&lt;br&gt;&amp;gt;&amp;gt; X = system ;
&lt;br&gt;&amp;gt;&amp;gt; X = a1 ;
&lt;br&gt;&amp;gt;&amp;gt; X = toplevel_variables ;
&lt;br&gt;&amp;gt;&amp;gt; X = license ;
&lt;br&gt;&amp;gt;&amp;gt; X = prolog_listing ;
&lt;br&gt;&amp;gt;&amp;gt; X = prolog ;
&lt;br&gt;&amp;gt;&amp;gt; X = a2 ;
&lt;br&gt;&amp;gt;&amp;gt; X = b ;
&lt;br&gt;&amp;gt;&amp;gt; false.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; ?- module(b).
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; b: &amp;nbsp;?- listing.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; d(0).
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; b: &amp;nbsp;?- module(a1).
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; a1: &amp;nbsp;?- listing.
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; a1: &amp;nbsp;?- module(a2).
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; a2: &amp;nbsp;?- listing.
&lt;br&gt;&amp;gt;&amp;gt; true.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;lt;
&lt;br&gt;&amp;gt;&amp;gt; Kuniaki Mukai
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; SWI-Prolog mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26516737&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; SWI-Prolog mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26516737&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26516737&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/compiling-a-file-into-its-variants-at-once-on-the-fly-tp26515323p26516737.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26515831</id>
	<title>Re: compiling a file into its variants at once on the fly</title>
	<published>2009-11-25T08:26:26Z</published>
	<updated>2009-11-25T08:26:26Z</updated>
	<author>
		<name>Jan Wielemaker-3</name>
	</author>
	<content type="html">Hi Kuniaki,
&lt;br&gt;&lt;br&gt;Note that modules are loaded only once. So, for the two references to
&lt;br&gt;reexport(b, []), only the first does something. The second is a simple
&lt;br&gt;no-op. You force the module to be reloaded using load_files/2, but you
&lt;br&gt;will always get the same result for a1:d(X) and a2:d(X) because they
&lt;br&gt;both export from the same module and there is always only one instance
&lt;br&gt;of that module. I.e. a reload will wipe b and then load the new
&lt;br&gt;definitions into it.
&lt;br&gt;&lt;br&gt;You can do such tricks using :- include/1. That loads the text verbatim
&lt;br&gt;into the module in which the directive appears, clausing all predicates
&lt;br&gt;and definitions that appear in them to exist multiple times.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cheers --- Jan
&lt;br&gt;&lt;br&gt;On Wednesday 25 November 2009 04:59:19 pm Kuniaki Mukai wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Preparing four tiny files below, I expected
&lt;br&gt;&amp;gt; the following results.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- [main].
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- a1:d(X).
&lt;br&gt;&amp;gt; X = 0.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- a2:d(X).
&lt;br&gt;&amp;gt; X = 1.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; However, as log below shows, it is &amp;nbsp;not the case.
&lt;br&gt;&amp;gt; Although I read &amp;nbsp;the help on &amp;nbsp;module at least twice,
&lt;br&gt;&amp;gt; I could not point out myself what is wrong with the code below.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What I want to do actually is to compile a file
&lt;br&gt;&amp;gt; into its (two) variants at once by switching parameters
&lt;br&gt;&amp;gt; on the fly.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thank &amp;nbsp;you in advance for any hint.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% module file: b.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; :- module(b,[]).
&lt;br&gt;&amp;gt; :-if(nb_getval(flag, true)).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; d(0).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; :-else.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; d(1).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; :- endif.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% end of file %%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% &amp;nbsp;module file: &amp;nbsp;a1.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; :-module(a1,[]).
&lt;br&gt;&amp;gt; :-reexport(b, []).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% end of file %%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% module file: a2.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; :-module(a2,[]).
&lt;br&gt;&amp;gt; :-reexport(b, []).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% end of file %%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% &amp;nbsp;main.pl &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; :-nb_setval(flag, true), use_module(a1).
&lt;br&gt;&amp;gt; :-nb_setval(flag, false), use_module(a2).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%% end of file &amp;nbsp; &amp;nbsp;%%%%%%
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; %%%
&lt;br&gt;&amp;gt; Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 5.8.1-4-ge648422)
&lt;br&gt;&amp;gt; Copyright (c) 1990-2009 University of Amsterdam.
&lt;br&gt;&amp;gt; SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
&lt;br&gt;&amp;gt; and you are welcome to redistribute it under certain conditions.
&lt;br&gt;&amp;gt; Please visit &lt;a href=&quot;http://www.swi-prolog.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.swi-prolog.org&lt;/a&gt;&amp;nbsp;for details.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; For help, use ?- help(Topic). or ?- apropos(Word).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- [main].
&lt;br&gt;&amp;gt; % &amp;nbsp; b compiled into b 0.00 sec, 968 bytes
&lt;br&gt;&amp;gt; % &amp;nbsp;a1 compiled into a1 0.00 sec, 2,144 bytes
&lt;br&gt;&amp;gt; % &amp;nbsp;a2 compiled into a2 0.00 sec, 832 bytes
&lt;br&gt;&amp;gt; % main compiled 0.00 sec, 4,728 bytes
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- a1:d(X).
&lt;br&gt;&amp;gt; Correct to: &amp;quot;b:d(X)&amp;quot;? y
&lt;br&gt;&amp;gt; X = 0.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- a2:d(X).
&lt;br&gt;&amp;gt; Correct to: &amp;quot;b:d(X)&amp;quot;? y
&lt;br&gt;&amp;gt; X = 0.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- listing.
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- current_module(X).
&lt;br&gt;&amp;gt; X = user ;
&lt;br&gt;&amp;gt; X = error ;
&lt;br&gt;&amp;gt; X = lists ;
&lt;br&gt;&amp;gt; X = system ;
&lt;br&gt;&amp;gt; X = a1 ;
&lt;br&gt;&amp;gt; X = toplevel_variables ;
&lt;br&gt;&amp;gt; X = license ;
&lt;br&gt;&amp;gt; X = prolog_listing ;
&lt;br&gt;&amp;gt; X = prolog ;
&lt;br&gt;&amp;gt; X = a2 ;
&lt;br&gt;&amp;gt; X = b ;
&lt;br&gt;&amp;gt; false.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ?- module(b).
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; b: &amp;nbsp;?- listing.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; d(0).
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; b: &amp;nbsp;?- module(a1).
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; a1: &amp;nbsp;?- listing.
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; a1: &amp;nbsp;?- module(a2).
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; a2: &amp;nbsp;?- listing.
&lt;br&gt;&amp;gt; true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;lt;
&lt;br&gt;&amp;gt; Kuniaki Mukai
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; SWI-Prolog mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26515831&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26515831&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/compiling-a-file-into-its-variants-at-once-on-the-fly-tp26515323p26515831.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26515323</id>
	<title>compiling a file into its variants at once on the fly</title>
	<published>2009-11-25T07:59:19Z</published>
	<updated>2009-11-25T07:59:19Z</updated>
	<author>
		<name>Kuniaki Mukai</name>
	</author>
	<content type="html">&lt;br&gt;Hi,
&lt;br&gt;&lt;br&gt;Preparing four tiny files below, I expected
&lt;br&gt;the following results.
&lt;br&gt;&lt;br&gt;?- [main].
&lt;br&gt;&lt;br&gt;?- a1:d(X).
&lt;br&gt;X = 0.
&lt;br&gt;&lt;br&gt;?- a2:d(X).
&lt;br&gt;X = 1.
&lt;br&gt;&lt;br&gt;However, as log below shows, it is &amp;nbsp;not the case.
&lt;br&gt;Although I read &amp;nbsp;the help on &amp;nbsp;module at least twice, 
&lt;br&gt;I could not point out myself what is wrong with the code below.
&lt;br&gt;&lt;br&gt;What I want to do actually is to compile a file 
&lt;br&gt;into its (two) variants at once by switching parameters
&lt;br&gt;on the fly. &amp;nbsp;
&lt;br&gt;&lt;br&gt;Thank &amp;nbsp;you in advance for any hint. 
&lt;br&gt;&lt;br&gt;%%% module file: b.pl &amp;nbsp;%%%%%%
&lt;br&gt;:- module(b,[]).
&lt;br&gt;:-if(nb_getval(flag, true)).
&lt;br&gt;d(0).
&lt;br&gt;:-else.
&lt;br&gt;d(1).
&lt;br&gt;:- endif.
&lt;br&gt;%%% end of file %%%%%%
&lt;br&gt;&lt;br&gt;%%% &amp;nbsp;module file: &amp;nbsp;a1.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-module(a1,[]).
&lt;br&gt;:-reexport(b, []).
&lt;br&gt;%%% end of file %%%%%%
&lt;br&gt;&lt;br&gt;%%% module file: a2.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-module(a2,[]).
&lt;br&gt;:-reexport(b, []).
&lt;br&gt;%%% end of file %%%%%%
&lt;br&gt;&lt;br&gt;%%% &amp;nbsp;main.pl &amp;nbsp;%%%%%%
&lt;br&gt;:-nb_setval(flag, true), use_module(a1).
&lt;br&gt;:-nb_setval(flag, false), use_module(a2).
&lt;br&gt;%%% end of file &amp;nbsp; &amp;nbsp;%%%%%%
&lt;br&gt;&lt;br&gt;%%%
&lt;br&gt;Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 5.8.1-4-ge648422)
&lt;br&gt;Copyright (c) 1990-2009 University of Amsterdam.
&lt;br&gt;SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
&lt;br&gt;and you are welcome to redistribute it under certain conditions.
&lt;br&gt;Please visit &lt;a href=&quot;http://www.swi-prolog.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.swi-prolog.org&lt;/a&gt;&amp;nbsp;for details.
&lt;br&gt;&lt;br&gt;For help, use ?- help(Topic). or ?- apropos(Word).
&lt;br&gt;&lt;br&gt;?- [main].
&lt;br&gt;% &amp;nbsp; b compiled into b 0.00 sec, 968 bytes
&lt;br&gt;% &amp;nbsp;a1 compiled into a1 0.00 sec, 2,144 bytes
&lt;br&gt;% &amp;nbsp;a2 compiled into a2 0.00 sec, 832 bytes
&lt;br&gt;% main compiled 0.00 sec, 4,728 bytes
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;?- a1:d(X).
&lt;br&gt;Correct to: &amp;quot;b:d(X)&amp;quot;? y
&lt;br&gt;X = 0.
&lt;br&gt;&lt;br&gt;?- a2:d(X).
&lt;br&gt;Correct to: &amp;quot;b:d(X)&amp;quot;? y
&lt;br&gt;X = 0.
&lt;br&gt;&lt;br&gt;?- listing.
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;?- current_module(X).
&lt;br&gt;X = user ;
&lt;br&gt;X = error ;
&lt;br&gt;X = lists ;
&lt;br&gt;X = system ;
&lt;br&gt;X = a1 ;
&lt;br&gt;X = toplevel_variables ;
&lt;br&gt;X = license ;
&lt;br&gt;X = prolog_listing ;
&lt;br&gt;X = prolog ;
&lt;br&gt;X = a2 ;
&lt;br&gt;X = b ;
&lt;br&gt;false.
&lt;br&gt;&lt;br&gt;?- module(b).
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;b: &amp;nbsp;?- listing.
&lt;br&gt;&lt;br&gt;d(0).
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;b: &amp;nbsp;?- module(a1).
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;a1: &amp;nbsp;?- listing.
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;a1: &amp;nbsp;?- module(a2).
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;a2: &amp;nbsp;?- listing.
&lt;br&gt;true.
&lt;br&gt;&lt;br&gt;&amp;lt;
&lt;br&gt;Kuniaki Mukai
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26515323&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/compiling-a-file-into-its-variants-at-once-on-the-fly-tp26515323p26515323.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26508776</id>
	<title>Re: Bug in zlib</title>
	<published>2009-11-24T23:25:56Z</published>
	<updated>2009-11-24T23:25:56Z</updated>
	<author>
		<name>Abramo Bagnara</name>
	</author>
	<content type="html">I apologize for multiple posting: I got confused by mailing list manager 
&lt;br&gt;bounce backs.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26508776&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug-in-zlib-tp26503334p26508776.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26504025</id>
	<title>Re: New to Prolog.A question.</title>
	<published>2009-11-24T13:59:50Z</published>
	<updated>2009-11-24T13:59:50Z</updated>
	<author>
		<name>Andrew Koster</name>
	</author>
	<content type="html">This function already exists in the library, but for the sake of the &amp;nbsp;
&lt;br&gt;exercise, here goes:
&lt;br&gt;&lt;br&gt;&amp;gt; substring([],[]).
&lt;br&gt;&amp;gt; substring(X,X).
&lt;br&gt;&amp;gt; substring(X,[H|T]):-substring(X,H).
&lt;br&gt;&amp;gt; substring(X,[H|T]):-substring(X,T).
&lt;br&gt;&lt;br&gt;What you are trying to do is match any part of the second parameter to &amp;nbsp;
&lt;br&gt;all of the first parameter. It is therefore important to distinguish 2 &amp;nbsp;
&lt;br&gt;different cases: you find a partial match, or you don't find a partial &amp;nbsp;
&lt;br&gt;match. First we'll rename it, because while you're applying this to a &amp;nbsp;
&lt;br&gt;string, it'll work on any list where the order matters.
&lt;br&gt;&lt;br&gt;Second, lets give the corrected predicate:
&lt;br&gt;&lt;br&gt;sublist([], _).
&lt;br&gt;sublist([M|MTail], [M|STail]) :- sublist_(MTail, STail).
&lt;br&gt;sublist(Pattern, [H|T]) :- sublist(Pattern, T).
&lt;br&gt;&lt;br&gt;sublist_([], _).
&lt;br&gt;sublist_([M|MTail], [M|STail]) :- sublist_(MTail, STail).
&lt;br&gt;&lt;br&gt;This can probably be written shorter and more optimized, but this way &amp;nbsp;
&lt;br&gt;it's clear what's going on. The base case is in case your pattern is &amp;nbsp;
&lt;br&gt;empty, in that case it should always succeed.
&lt;br&gt;The other two cases are the important bits: if the head of your &amp;nbsp;
&lt;br&gt;pattern matches the head of your list, then you want to check that the &amp;nbsp;
&lt;br&gt;rest of your pattern matches exactly with the next part of the list. &amp;nbsp;
&lt;br&gt;That is what the sublist_/2 predicate does. If that succeeds the &amp;nbsp;
&lt;br&gt;predicate succeeds and you've found a match.
&lt;br&gt;&lt;br&gt;In any other case, the predicate should recurse over the list, using &amp;nbsp;
&lt;br&gt;the complete pattern.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Andrew
&lt;br&gt;&lt;br&gt;PS. I don't think there are any errors, but I don't have prolog &amp;nbsp;
&lt;br&gt;installed on this computer and haven't checked it.
&lt;br&gt;&lt;br&gt;Quoting Raul Reinaldo &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26504025&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;momentofpeace1@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; Hi everyone,
&lt;br&gt;&amp;gt; &amp;nbsp;I've been trying to create function &amp;quot;substring&amp;quot;(X,Y),that returns &amp;quot;true&amp;quot; if
&lt;br&gt;&amp;gt; Y contains X string(f.e. if X is [5,1] Y must have &amp;quot;5,1&amp;quot; in order for the
&lt;br&gt;&amp;gt; function to be true).
&lt;br&gt;&amp;gt; &amp;nbsp;I've tried the following:
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp;But this doesn't work correctly(f.e. substring([5,1],[5,1,7]) will be
&lt;br&gt;&amp;gt; false). What am I doing wrong?
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &amp;nbsp;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/New-to-Prolog.A-question.-tp26499935p26499935.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/New-to-Prolog.A-question.-tp26499935p26499935.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the SWI Prolog mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; SWI-Prolog mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26504025&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;----------------------------------------------------------------
&lt;br&gt;This message was sent using IMP, the Internet Messaging Program.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26504025&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/New-to-Prolog.A-question.-tp26499935p26504025.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26499935</id>
	<title>New to Prolog.A question.</title>
	<published>2009-11-24T11:16:04Z</published>
	<updated>2009-11-24T11:16:04Z</updated>
	<author>
		<name>Raul Reinaldo</name>
	</author>
	<content type="html">&amp;nbsp; Hi everyone,
&lt;br&gt;&amp;nbsp;I've been trying to create function &amp;quot;substring&amp;quot;(X,Y),that returns &amp;quot;true&amp;quot; if Y contains X string(f.e. if X is [5,1] Y must have &amp;quot;5,1&amp;quot; in order for the function to be true). 
&lt;br&gt;&amp;nbsp;I've tried the following: 
&lt;br&gt;&lt;br&gt;substring([],[]).
&lt;br&gt;substring(X,X).
&lt;br&gt;substring(X,[H|T]):-substring(X,H).
&lt;br&gt;substring(X,[H|T]):-substring(X,T).
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;But this doesn't work correctly(f.e. substring([5,1],[5,1,7]) will be false). What am I doing wrong?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/New-to-Prolog.A-question.-tp26499935p26499935.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26501270</id>
	<title>Re: Translation problem with Prolog</title>
	<published>2009-11-24T10:40:04Z</published>
	<updated>2009-11-24T10:40:04Z</updated>
	<author>
		<name>Ulrich Neumerkel</name>
	</author>
	<content type="html">BasHV:
&lt;br&gt;&amp;gt;With these lists I know how to translate from NE to EN and from EN to FA,
&lt;br&gt;&amp;gt;but I would like to know if it is possible to use these 2 lists and
&lt;br&gt;&amp;gt;translate from NE to FA.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;I have defined the first two Prolog clauses like this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;trans_ne([], []).
&lt;br&gt;&amp;gt;trans_ne([NE|Ta], [EN|Tb]) :- ne(NE,EN), trans_ne(Ta,Tb).
&lt;br&gt;&lt;br&gt;Consider:
&lt;br&gt;&lt;br&gt;?- maplist(ne, NEs, ENs).
&lt;br&gt;&lt;br&gt;?- maplist(\NE^EN^ne(NE,EN), NEs, ENs).
&lt;br&gt;&lt;br&gt;?- maplist(\NE^FR^(ne(NE,EN),ef(EN,FR)), NEs, FRs).
&lt;br&gt;&lt;br&gt;Using library(apply) and library(lambda)
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/lambda.pl&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/lambda.pl&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26501270&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26501270.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26500606</id>
	<title>RE: Translation problem with Prolog</title>
	<published>2009-11-24T09:56:48Z</published>
	<updated>2009-11-24T09:56:48Z</updated>
	<author>
		<name>Carroll, Michael L.</name>
	</author>
	<content type="html">&lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=gb2312&quot;&gt;
&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;

&lt;meta name=Generator content=&quot;Microsoft Word 11 (filtered medium)&quot;&gt;
&lt;!--[if !mso]&gt;
&lt;style&gt;
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
&lt;/style&gt;
&lt;![endif]--&gt;


&lt;/head&gt;

&lt;body lang=EN-US link=blue vlink=blue&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 color=navy face=Arial&gt;&lt;span style='font-size:
10.0pt;font-family:Arial;color:navy'&gt;Dear &amp;lt;Sorry, I can’t read your name
because the characters are in Chinese and there is no signature block&amp;gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 color=navy face=Arial&gt;&lt;span style='font-size:
10.0pt;font-family:Arial;color:navy'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 color=navy face=Arial&gt;&lt;span style='font-size:
10.0pt;font-family:Arial;color:navy'&gt;You are right about there being no need
for an accumulator. &amp;nbsp;The translation works without them. &amp;nbsp;I stand corrected.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 color=navy face=Arial&gt;&lt;span style='font-size:
10.0pt;font-family:Arial;color:navy'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div&gt;

&lt;p&gt;&lt;font size=2 color=navy face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:10.0pt;
color:navy'&gt;Regards,&lt;br&gt;
Mike&lt;br&gt;
&lt;br&gt;
Michael L. Carroll&lt;br&gt;
Software Integrator&lt;br&gt;
GPS SE&amp;amp;I Program&lt;br&gt;
SAIC&lt;br&gt;
310-416-8357&lt;br&gt;
&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=navy face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial;color:navy'&gt;BB: 424-207-7221&lt;/span&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;span style='font-size:10.0pt'&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;div class=MsoNormal align=center style='text-align:center'&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:12.0pt'&gt;

&lt;hr size=2 width=&quot;100%&quot; align=center tabindex=-1&gt;

&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;

&lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Tahoma&gt;&lt;span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'&gt;From:&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Tahoma&gt;&lt;span style='font-size:10.0pt;font-family:Tahoma'&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500606&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;swi-prolog-admin@...&lt;/a&gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500606&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;swi-prolog-admin@...&lt;/a&gt;] &lt;b&gt;&lt;span style='font-weight:bold'&gt;On Behalf Of &lt;/span&gt;&lt;/b&gt;???&lt;br&gt;
&lt;b&gt;&lt;span style='font-weight:bold'&gt;Sent:&lt;/span&gt;&lt;/b&gt; Tuesday, November 24, 2009
9:05 AM&lt;br&gt;
&lt;b&gt;&lt;span style='font-weight:bold'&gt;To:&lt;/span&gt;&lt;/b&gt; SWI-Prolog maillinglist&lt;br&gt;
&lt;b&gt;&lt;span style='font-weight:bold'&gt;Subject:&lt;/span&gt;&lt;/b&gt; Re: [SWIPL] Translation
problem with Prolog&lt;/span&gt;&lt;/font&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Bas,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;if you have two relations trans_ne and trans_ef, and then you must have
a transitive relation. Try to query:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;?- trans_ne( [een,one], X), trans_ef(X, Y).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;You will get:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;X = [one, two],&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Y = [un, deux].&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Thus you may have a trans_nf/2:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;trans_nf(NEs, FAs) :- trans_ne(NEs, Tmp), trans_ef(Tmp, FAs).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;This is the general transitive law that if you have relations A-&amp;gt;B
and B-&amp;gt;C, you must have A-&amp;gt;C.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;-------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Besides, Carroll, I'm not really understand what you said about
&amp;quot;rather than just check if they can be accomplished.&amp;quot; For me, the
&amp;quot;rather-than&amp;quot; method works in many cases.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;----------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;And back to the list-translating problem, what if some of all terms in
the list cannot be translated? For example, when you query:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;?- trans_ne( [eenn, twee], ENs).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;false.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Some error occurring in a list means the whole list false. Is it a
meaningful answer?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;On Tue, Nov 24, 2009 at 8:40 PM, BasHV &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500606&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bashovestad@...&lt;/a&gt;&amp;gt; wrote:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;ne(een,one).&lt;br&gt;
ne(twee,two).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;ef(one,un).&lt;br&gt;
ef(two,deux).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/blockquote&gt;

&lt;div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;With these lists I know how to translate from NE to EN and from EN to
FA,&lt;br&gt;
but I would like to know if it is possible to use these 2 lists and&lt;br&gt;
translate from NE to FA.&lt;br&gt;
&lt;br&gt;
I have defined the first two Prolog clauses like this:&lt;br&gt;
&lt;br&gt;
trans_ne([], []).&lt;br&gt;
trans_ne([NE|Ta], [EN|Tb]) :- ne(NE,EN), trans_ne(Ta,Tb).&lt;br&gt;
&lt;br&gt;
trans_ef([], []).&lt;br&gt;
trans_ef([EN|Ta], [EN|Tb]) :- ef(EN,FA), trans_ef(Ta,Tb).&lt;br&gt;
&lt;br&gt;
Thanks in advance,&lt;br&gt;
&lt;br&gt;
Bas&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;span style='color:#888888'&gt;--&lt;br&gt;
View this message in context: &lt;a href=&quot;http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26495179.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26495179.html&lt;/a&gt;&lt;br&gt;
Sent from the SWI Prolog mailing list archive at Nabble.com.&lt;br&gt;
&lt;br&gt;
_______________________________________________&lt;br&gt;
SWI-Prolog mailing list&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500606&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;/span&gt;&lt;/font&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/blockquote&gt;

&lt;/div&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26500606.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26500344</id>
	<title>Critical bug in zlib library</title>
	<published>2009-11-24T09:39:10Z</published>
	<updated>2009-11-24T09:39:10Z</updated>
	<author>
		<name>Roberto Bagnara</name>
	</author>
	<content type="html">&lt;br&gt;We've found a critical bug in zlib library.
&lt;br&gt;&lt;br&gt;The predicate test/0 above can be used to trigger the bug:
&lt;br&gt;&lt;br&gt;random_codes(N, N, []) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;!.
&lt;br&gt;random_codes(Count, N, [Code|Tail]) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Code is random(256),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Count1 is Count+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;random_codes(Count1, N, Tail).
&lt;br&gt;&lt;br&gt;test(N, File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format('Writing ~a bytes~n', [N]),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;gzopen(File, write, Write),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;random_codes(0, N, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;atom_codes(Atom, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;write(Write, Atom),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;close(Write),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format('Reading ~a bytes~n', [N]),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;gzopen(File, read, Read),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;read_stream_to_codes(Read, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;close(Read).
&lt;br&gt;&lt;br&gt;test(N, N, _File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;!.
&lt;br&gt;test(Count, N, File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(Count, File),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Count1 is Count+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(Count1, N, File).
&lt;br&gt;&lt;br&gt;test :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set_random(seed(0)),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(3300, 5000, 'out.gz').
&lt;br&gt;&lt;br&gt;&amp;nbsp;From our analysis the bug is triggered when the gzipped file is a
&lt;br&gt;little bigger than SIO_BUFSIZE (4096 bytes).
&lt;br&gt;&lt;br&gt;pl is blocked in this infinite loop present in function zread (zlib4pl.c):
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;while( (rc=gz_skip_footer(ctx)) == -2 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* TBD: read more */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;The &amp;quot;To Be Done&amp;quot; marker seems to imply that the problem is known, but
&lt;br&gt;we wonder if its importance has been underestimated.
&lt;br&gt;&lt;br&gt;Note that we have found this misbehaviour in a real application that
&lt;br&gt;hangs unexpectedly reading gzipped files of unlucky size.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Abramo and Roberto Bagnara
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Prof. Roberto Bagnara
&lt;br&gt;Applied Formal Methods Laboratory
&lt;br&gt;Department of Mathematics, University of Parma, Italy
&lt;br&gt;&lt;a href=&quot;http://www.cs.unipr.it/~bagnara/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.unipr.it/~bagnara/&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500344&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bagnara@...&lt;/a&gt;
&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500344&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Critical-bug-in-zlib-library-tp26500344p26500344.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26500268</id>
	<title>Re: Translation problem with Prolog</title>
	<published>2009-11-24T09:04:47Z</published>
	<updated>2009-11-24T09:04:47Z</updated>
	<author>
		<name>黃耀賢</name>
	</author>
	<content type="html">Bas,&lt;div&gt;if you have two relations trans_ne and trans_ef, and then you must have a transitive relation. Try to query:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;?- trans_ne( [een,one], X), trans_ef(X, Y).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;You will get:&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;X = [one, two],&lt;/div&gt;&lt;div&gt;Y = [un, deux].&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thus you may have a trans_nf/2:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;trans_nf(NEs, FAs) :- trans_ne(NEs, Tmp), trans_ef(Tmp, FAs).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;This is the general transitive law that if you have relations A-&amp;gt;B and B-&amp;gt;C, you must have A-&amp;gt;C.&lt;/div&gt;&lt;div&gt;-------------&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Besides, Carroll, I&amp;#39;m not really understand what you said about &amp;quot;rather than just check if they can be accomplished.&amp;quot; For me, the &amp;quot;rather-than&amp;quot; method works in many cases.&lt;/div&gt;
&lt;div&gt;&lt;div&gt;----------------&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And back to the list-translating problem, what if some of all terms in the list cannot be translated? For example, when you query:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;?- trans_ne( [eenn, twee], ENs).&lt;/div&gt;
&lt;div&gt;false.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Some error occurring in a list means the whole list false. Is it a meaningful answer?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Nov 24, 2009 at 8:40 PM, BasHV &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500268&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bashovestad@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;ne(een,one).&lt;br&gt;
ne(twee,two).&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;ef(one,un).&lt;br&gt;
ef(two,deux).&lt;br&gt;
&lt;/blockquote&gt;&lt;div&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;
With these lists I know how to translate from NE to EN and from EN to FA,&lt;br&gt;
but I would like to know if it is possible to use these 2 lists and&lt;br&gt;
translate from NE to FA.&lt;br&gt;
&lt;br&gt;
I have defined the first two Prolog clauses like this:&lt;br&gt;
&lt;br&gt;
trans_ne([], []).&lt;br&gt;
trans_ne([NE|Ta], [EN|Tb]) :- ne(NE,EN), trans_ne(Ta,Tb).&lt;br&gt;
&lt;br&gt;
trans_ef([], []).&lt;br&gt;
trans_ef([EN|Ta], [EN|Tb]) :- ef(EN,FA), trans_ef(Ta,Tb).&lt;br&gt;
&lt;br&gt;
Thanks in advance,&lt;br&gt;
&lt;br&gt;
Bas&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;--&lt;br&gt;
View this message in context: &lt;a href=&quot;http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26495179.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26495179.html&lt;/a&gt;&lt;br&gt;

Sent from the SWI Prolog mailing list archive at Nabble.com.&lt;br&gt;
&lt;br&gt;
_______________________________________________&lt;br&gt;
SWI-Prolog mailing list&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26500268&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26500268.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26503334</id>
	<title>Bug in zlib</title>
	<published>2009-11-24T08:33:02Z</published>
	<updated>2009-11-24T08:33:02Z</updated>
	<author>
		<name>Abramo Bagnara</name>
	</author>
	<content type="html">&lt;br&gt;We've found a critical bug in zlib library.
&lt;br&gt;&lt;br&gt;The predicate test/0 above can be used to trigger the bug:
&lt;br&gt;&lt;br&gt;random_codes(N, N, []) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;!.
&lt;br&gt;random_codes(Count, N, [Code|Tail]) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Code is random(256),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Count1 is Count+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;random_codes(Count1, N, Tail).
&lt;br&gt;&lt;br&gt;test(N, File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format('Writing ~a bytes~n', [N]),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;gzopen(File, write, Write),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;random_codes(0, N, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;atom_codes(Atom, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;write(Write, Atom),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;close(Write),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format('Reading ~a bytes~n', [N]),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;gzopen(File, read, Read),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;read_stream_to_codes(Read, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;close(Read).
&lt;br&gt;&lt;br&gt;test(N, N, _File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;!.
&lt;br&gt;test(Count, N, File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(Count, File),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Count1 is Count+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(Count1, N, File).
&lt;br&gt;&lt;br&gt;test :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set_random(seed(0)),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(3300, 5000, 'out.gz').
&lt;br&gt;&lt;br&gt;&amp;nbsp;From our analysis the bug is triggered when the gzipped file is a
&lt;br&gt;little bigger than SIO_BUFSIZE (4096 bytes).
&lt;br&gt;&lt;br&gt;pl is blocked in this infinite loop present in function zread (zlib4pl.c):
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;while( (rc=gz_skip_footer(ctx)) == -2 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* TBD: read more */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;The &amp;quot;To Be Done&amp;quot; marker seems to imply that the problem is known, but
&lt;br&gt;we wonder if its importance has been underestimated.
&lt;br&gt;&lt;br&gt;Note that we have found this misbehaviour in a real application that
&lt;br&gt;hangs unexpectedly reading gzipped files of unlucky size.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Abramo and Roberto Bagnara
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Prof. Roberto Bagnara
&lt;br&gt;Applied Formal Methods Laboratory
&lt;br&gt;Department of Mathematics, University of Parma, Italy
&lt;br&gt;&lt;a href=&quot;http://www.cs.unipr.it/~bagnara/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.unipr.it/~bagnara/&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26503334&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bagnara@...&lt;/a&gt;
&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26503334&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug-in-zlib-tp26503334p26503334.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26503347</id>
	<title>Bug in zlib</title>
	<published>2009-11-24T08:20:50Z</published>
	<updated>2009-11-24T08:20:50Z</updated>
	<author>
		<name>Abramo Bagnara</name>
	</author>
	<content type="html">&lt;br&gt;We've found a critical bug in zlib library.
&lt;br&gt;&lt;br&gt;The predicate test/0 above can be used to trigger the bug:
&lt;br&gt;&lt;br&gt;random_codes(N, N, []) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;!.
&lt;br&gt;random_codes(Count, N, [Code|Tail]) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Code is random(256),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Count1 is Count+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;random_codes(Count1, N, Tail).
&lt;br&gt;&lt;br&gt;test(N, File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format('Writing ~a bytes~n', [N]),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;gzopen(File, write, Write),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;random_codes(0, N, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;atom_codes(Atom, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;write(Write, Atom),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;close(Write),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format('Reading ~a bytes~n', [N]),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;gzopen(File, read, Read),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;read_stream_to_codes(Read, Codes),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;close(Read).
&lt;br&gt;&lt;br&gt;test(N, N, _File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;!.
&lt;br&gt;test(Count, N, File) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(Count, File),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Count1 is Count+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(Count1, N, File).
&lt;br&gt;&lt;br&gt;test :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set_random(seed(0)),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;test(3300, 5000, 'out.gz').
&lt;br&gt;&lt;br&gt;&amp;nbsp;From our analysis the bug is triggered when the gzipped file is a
&lt;br&gt;little bigger than SIO_BUFSIZE (4096 bytes).
&lt;br&gt;&lt;br&gt;pl is blocked in this infinite loop present in function zread (zlib4pl.c):
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;while( (rc=gz_skip_footer(ctx)) == -2 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* TBD: read more */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;The &amp;quot;To Be Done&amp;quot; marker seems to imply that the problem is known, but
&lt;br&gt;we wonder if its importance has been underestimated.
&lt;br&gt;&lt;br&gt;Note that we have found this misbehaviour in a real application that
&lt;br&gt;hangs unexpectedly reading gzipped files of unlucky size.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Abramo and Roberto Bagnara
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Prof. Roberto Bagnara
&lt;br&gt;Applied Formal Methods Laboratory
&lt;br&gt;Department of Mathematics, University of Parma, Italy
&lt;br&gt;&lt;a href=&quot;http://www.cs.unipr.it/~bagnara/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.unipr.it/~bagnara/&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26503347&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bagnara@...&lt;/a&gt;
&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26503347&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug-in-zlib-tp26503347p26503347.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26498173</id>
	<title>RE: Translation problem with Prolog</title>
	<published>2009-11-24T07:38:31Z</published>
	<updated>2009-11-24T07:38:31Z</updated>
	<author>
		<name>Carroll, Michael L.</name>
	</author>
	<content type="html">Bas,
&lt;br&gt;&lt;br&gt;Ditto what Graham said. &amp;nbsp;In addition, you might want to add an
&lt;br&gt;accumulator so that your list predicates actually produce the
&lt;br&gt;translations rather than just check if they can be accomplished.
&lt;br&gt;Something along these lines:
&lt;br&gt;&lt;br&gt;trans_ne(NEs,ENs) :- trans_ne(NEs,[],Tmp),reverse(Tmp,ENs).
&lt;br&gt;trans_ne([], ENs,ENs).
&lt;br&gt;trans_ne([NE|Ta], Acc1, ENs) :- 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ne(NE,EN), 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Acc2=[EN|Acc1],
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; trans_ne(Ta,Acc2, ENs).
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Mike
&lt;br&gt;&lt;br&gt;Michael L. Carroll
&lt;br&gt;Software Integrator
&lt;br&gt;GPS SE&amp;I Program
&lt;br&gt;SAIC
&lt;br&gt;310-416-8357
&lt;br&gt;BB: 424-207-7221
&lt;br&gt;&lt;br&gt;&lt;br&gt;-----Original Message-----
&lt;br&gt;From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26498173&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;swi-prolog-admin@...&lt;/a&gt;
&lt;br&gt;[mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26498173&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;swi-prolog-admin@...&lt;/a&gt;] On Behalf Of BasHV
&lt;br&gt;Sent: Tuesday, November 24, 2009 4:40 AM
&lt;br&gt;To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26498173&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;swi-prolog@...&lt;/a&gt;
&lt;br&gt;Subject: [SWIPL] Translation problem with Prolog
&lt;br&gt;&lt;br&gt;&lt;br&gt;Hi everyone,
&lt;br&gt;&lt;br&gt;I'm struggling with a problem and I hope someone can help me. I'm
&lt;br&gt;working on
&lt;br&gt;a small translation system in order to extend my knowledge of Prolog,
&lt;br&gt;however there is a thing I don't get.
&lt;br&gt;&lt;br&gt;The situation is as follows:
&lt;br&gt;&lt;br&gt;I have for example 2 lists like this:
&lt;br&gt;&lt;br&gt;ne(een,one).
&lt;br&gt;ne(twee,two).
&lt;br&gt;ne(drie,three).
&lt;br&gt;ne(vier,four).
&lt;br&gt;ne(vijf,five).
&lt;br&gt;ne(zes,six).
&lt;br&gt;ne(zeven,seven).
&lt;br&gt;ne(acht,eight).
&lt;br&gt;ne(negen,nine).
&lt;br&gt;ne(tien,ten).
&lt;br&gt;&lt;br&gt;ef(one,un).
&lt;br&gt;ef(two,deux).
&lt;br&gt;ef(three,trois).
&lt;br&gt;ef(four,quatre).
&lt;br&gt;ef(five,cinq).
&lt;br&gt;ef(six,six).
&lt;br&gt;ef(seven,sept).
&lt;br&gt;ef(eight,huit).
&lt;br&gt;ef(nine,neuf).
&lt;br&gt;ef(ten,dix).
&lt;br&gt;&lt;br&gt;With these lists I know how to translate from NE to EN and from EN to
&lt;br&gt;FA,
&lt;br&gt;but I would like to know if it is possible to use these 2 lists and
&lt;br&gt;translate from NE to FA.
&lt;br&gt;&lt;br&gt;I have defined the first two Prolog clauses like this:
&lt;br&gt;&lt;br&gt;trans_ne([], []).
&lt;br&gt;trans_ne([NE|Ta], [EN|Tb]) :- ne(NE,EN), trans_ne(Ta,Tb).
&lt;br&gt;&lt;br&gt;trans_ef([], []).
&lt;br&gt;trans_ef([EN|Ta], [EN|Tb]) :- ef(EN,FA), trans_ef(Ta,Tb).
&lt;br&gt;&lt;br&gt;Thanks in advance,
&lt;br&gt;&lt;br&gt;Bas
&lt;br&gt;-- 
&lt;br&gt;View this message in context:
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p2649517&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p2649517&lt;/a&gt;&lt;br&gt;9.html
&lt;br&gt;Sent from the SWI Prolog mailing list archive at Nabble.com.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26498173&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26498173&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26498173.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26497625</id>
	<title>RE: Translation problem with Prolog</title>
	<published>2009-11-24T06:41:24Z</published>
	<updated>2009-11-24T06:41:24Z</updated>
	<author>
		<name>graham thwaites-2</name>
	</author>
	<content type="html">&amp;nbsp;
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The situation is as follows:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I have for example 2 lists like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ne(een,one).
&lt;br&gt;&amp;gt; ne(twee,two).
&lt;br&gt;&amp;gt; ne(drie,three).
&lt;br&gt;&amp;gt; ne(vier,four).
&lt;br&gt;&amp;gt; ne(vijf,five).
&lt;br&gt;&amp;gt; ne(zes,six).
&lt;br&gt;&amp;gt; ne(zeven,seven).
&lt;br&gt;&amp;gt; ne(acht,eight).
&lt;br&gt;&amp;gt; ne(negen,nine).
&lt;br&gt;&amp;gt; ne(tien,ten).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ef(one,un).
&lt;br&gt;&amp;gt; ef(two,deux).
&lt;br&gt;&amp;gt; ef(three,trois).
&lt;br&gt;&amp;gt; ef(four,quatre).
&lt;br&gt;&amp;gt; ef(five,cinq).
&lt;br&gt;&amp;gt; ef(six,six).
&lt;br&gt;&amp;gt; ef(seven,sept).
&lt;br&gt;&amp;gt; ef(eight,huit).
&lt;br&gt;&amp;gt; ef(nine,neuf).
&lt;br&gt;&amp;gt; ef(ten,dix).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; With these lists I know how to translate from NE to EN and 
&lt;br&gt;&amp;gt; from EN to FA, but I would like to know if it is possible to 
&lt;br&gt;&amp;gt; use these 2 lists and translate from NE to FA.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I have defined the first two Prolog clauses like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; trans_ne([], []).
&lt;br&gt;&amp;gt; trans_ne([NE|Ta], [EN|Tb]) :- ne(NE,EN), trans_ne(Ta,Tb).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; trans_ef([], []).
&lt;br&gt;&amp;gt; trans_ef([EN|Ta], [EN|Tb]) :- ef(EN,FA), trans_ef(Ta,Tb).
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;The second clause for trans_ef/2 is wrong - it will translate EN to EN,
&lt;br&gt;not EN to EF.
&lt;br&gt;&lt;br&gt;NB you should have got a singleton variable warning for FA when you
&lt;br&gt;compiled this clause. This is often a sign of something amiss and always
&lt;br&gt;worth looking for!
&lt;br&gt;&lt;br&gt;To achieve your other aim you could either translate a complete list NE
&lt;br&gt;to EN, and then translate this intermediate result EN to FA.
&lt;br&gt;Alternatively, you could translate each element of the list &amp;nbsp;NE to EN
&lt;br&gt;then EN to FA.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;Graham
&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26497625&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26497625.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26495179</id>
	<title>Translation problem with Prolog</title>
	<published>2009-11-24T04:40:19Z</published>
	<updated>2009-11-24T04:40:19Z</updated>
	<author>
		<name>BasHV</name>
	</author>
	<content type="html">Hi everyone,
&lt;br&gt;&lt;br&gt;I'm struggling with a problem and I hope someone can help me. I'm working on a small translation system in order to extend my knowledge of Prolog, however there is a thing I don't get.
&lt;br&gt;&lt;br&gt;The situation is as follows:
&lt;br&gt;&lt;br&gt;I have for example 2 lists like this:
&lt;br&gt;&lt;br&gt;ne(een,one).
&lt;br&gt;ne(twee,two).
&lt;br&gt;ne(drie,three).
&lt;br&gt;ne(vier,four).
&lt;br&gt;ne(vijf,five).
&lt;br&gt;ne(zes,six).
&lt;br&gt;ne(zeven,seven).
&lt;br&gt;ne(acht,eight).
&lt;br&gt;ne(negen,nine).
&lt;br&gt;ne(tien,ten).
&lt;br&gt;&lt;br&gt;ef(one,un).
&lt;br&gt;ef(two,deux).
&lt;br&gt;ef(three,trois).
&lt;br&gt;ef(four,quatre).
&lt;br&gt;ef(five,cinq).
&lt;br&gt;ef(six,six).
&lt;br&gt;ef(seven,sept).
&lt;br&gt;ef(eight,huit).
&lt;br&gt;ef(nine,neuf).
&lt;br&gt;ef(ten,dix).
&lt;br&gt;&lt;br&gt;With these lists I know how to translate from NE to EN and from EN to FA, but I would like to know if it is possible to use these 2 lists and translate from NE to FA.
&lt;br&gt;&lt;br&gt;I have defined the first two Prolog clauses like this:
&lt;br&gt;&lt;br&gt;trans_ne([], []).
&lt;br&gt;trans_ne([NE|Ta], [EN|Tb]) :- ne(NE,EN), trans_ne(Ta,Tb).
&lt;br&gt;&lt;br&gt;trans_ef([], []).
&lt;br&gt;trans_ef([EN|Ta], [EN|Tb]) :- ef(EN,FA), trans_ef(Ta,Tb).
&lt;br&gt;&lt;br&gt;Thanks in advance,
&lt;br&gt;&lt;br&gt;Bas</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Translation-problem-with-Prolog-tp26495179p26495179.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26490058</id>
	<title>Re: help with swi prolog program</title>
	<published>2009-11-23T19:38:10Z</published>
	<updated>2009-11-23T19:38:10Z</updated>
	<author>
		<name>Ulrich Neumerkel</name>
	</author>
	<content type="html">Richard O'Keefe:
&lt;br&gt;&amp;gt;setof/3 and bagof/3 were originally designed as more principled
&lt;br&gt;&amp;gt;&amp;quot;relational calculus&amp;quot;-like operations to do database-y things.
&lt;br&gt;&amp;gt;Very little thought was given to what they should do with non-ground
&lt;br&gt;&amp;gt;results.
&lt;br&gt;...
&lt;br&gt;&amp;gt;Right up to the (very much delayed) time that the Prolog standard
&lt;br&gt;&amp;gt;came out, nobody (except Lee Naish) had given any thought to what
&lt;br&gt;&amp;gt;setof/3 and bagof/3 should do in the presence of *constrained*
&lt;br&gt;&amp;gt;variables.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;That was a mistake. &amp;nbsp;By the time the ISO Prolog standard came out,
&lt;br&gt;&amp;gt;it was already obsolete.
&lt;br&gt;&lt;br&gt;A standard is not a substitute for research. &amp;nbsp;At that time, systems
&lt;br&gt;like Quintus did not have constraints - not even freeze/2. &amp;nbsp;No current
&lt;br&gt;practice - no standard for it.
&lt;br&gt;&lt;br&gt;Even today the situation is not that rosy. &amp;nbsp;Look at all the various
&lt;br&gt;approaches to clpfd!
&lt;br&gt;&lt;br&gt;What the standard did quite nicely w.r.t constraints was to very
&lt;br&gt;clearly distinguish between instantiation errors and type errors. &amp;nbsp;It
&lt;br&gt;even reserved a place to integrate constraints via arithmetic
&lt;br&gt;predicates. &amp;nbsp;But that idea never caught on.
&lt;br&gt;&lt;br&gt;&amp;gt;Adding constraints to SWI Prolog made a lot of things rather puzzling.
&lt;br&gt;&amp;gt;Subsumption checks are actually at the top of my list.
&lt;br&gt;&lt;br&gt;Please do not miss my current version (V5) for subsumes_term/2!
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/subsumes_term.pl&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/subsumes_term.pl&lt;/a&gt;&lt;br&gt;&lt;br&gt;It is certainly not the optimum, but it is difficult to proceed.
&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26490058&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-help-with-swi-prolog-program-tp26437268p26490058.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26489623</id>
	<title>Re: Coding Guidelines for Prolog</title>
	<published>2009-11-23T18:29:39Z</published>
	<updated>2009-11-23T18:29:39Z</updated>
	<author>
		<name>Ulrich Neumerkel</name>
	</author>
	<content type="html">Tom Schrijvers:
&lt;br&gt;&amp;gt;Since you mention skeletons, have you looked at the logical loops library
&lt;br&gt;&amp;gt;by Joachim Schimpf? ...
&lt;br&gt;&lt;br&gt;Logical loops, while a quite expressive formalism, have some
&lt;br&gt;undesirable properties that seem to be deeply connected to the precise
&lt;br&gt;formalism. &amp;nbsp;In the implementation, the actual source of these problems
&lt;br&gt;are the red cuts used.
&lt;br&gt;&lt;br&gt;As a consequence, programs that would be pure monotonic programs with
&lt;br&gt;easy to grasp termination properties, now become very difficult to
&lt;br&gt;model. &amp;nbsp;Some examples:
&lt;br&gt;&lt;br&gt;Omission of solutions:
&lt;br&gt;&lt;br&gt;?- freeze(Xs, (Xs=[];Xs=[a])), ( foreach(a, Xs) do true ).
&lt;br&gt;&lt;br&gt;Finds only the first one. &amp;nbsp;Expected:
&lt;br&gt;&lt;br&gt;?- freeze(Xs, (Xs=[];Xs=[a])), maplist(=(a),Xs).
&lt;br&gt;Xs = [] ;
&lt;br&gt;Xs = &amp;quot;a&amp;quot;.
&lt;br&gt;&lt;br&gt;?- ( foreach(a,Xs) do true ), Xs = [_|_].
&lt;br&gt;&lt;br&gt;fails, in constrast to
&lt;br&gt;&lt;br&gt;?- maplist(=(a),Xs), Xs = [_|_].
&lt;br&gt;Xs = &amp;quot;a&amp;quot; ;
&lt;br&gt;Xs = &amp;quot;aa&amp;quot; ;
&lt;br&gt;&lt;br&gt;Erratic nontermination properties:
&lt;br&gt;&lt;br&gt;?- ( for(_,1,2), for(_,1,3) do true ).
&lt;br&gt;&lt;br&gt;?- ( for(I, 1,1), foreach(I, Is) do true ).
&lt;br&gt;&lt;br&gt;terminates, but adding Is = [_,_|_] in front loops.
&lt;br&gt;&lt;br&gt;These problems are very reminiscent of the many nonsteadfast programs
&lt;br&gt;in the 1980s.
&lt;br&gt;&lt;br&gt;Another problem of loops is nesting. &amp;nbsp;On each level you have to
&lt;br&gt;&amp;quot;redeclare&amp;quot; variables with global scope. &amp;nbsp;Try to define the following
&lt;br&gt;using logical loops. &amp;nbsp;Here it is defined with the traditional higher
&lt;br&gt;order library(maplist) plus library(lambda).
&lt;br&gt;&lt;br&gt;?- Xss = [[_,_]],maplist(maplist(Y+\X^Z^(X+Y#=Z)), Xss, Zss).
&lt;br&gt;Xss = [[_G416, _G419]],
&lt;br&gt;Zss = [[_G449, _G452]],
&lt;br&gt;_G416+Y#=_G449,
&lt;br&gt;_G419+Y#=_G452.
&lt;br&gt;&lt;br&gt;&lt;br&gt;There are nevertheless many good points of logical loops: One is that
&lt;br&gt;frequently the variables that belong to each other are textually
&lt;br&gt;closer and thus much easier to read. &amp;nbsp;Also &amp;quot;adding another argument&amp;quot;
&lt;br&gt;is often very easy to express. &amp;nbsp;Further, the default variable scoping
&lt;br&gt;is local, and thus anonymous variables are local.
&lt;br&gt;&lt;br&gt;There is still room for improvement. &amp;nbsp;And somewhat I am convinced that
&lt;br&gt;the traditional call/N approach will be part of it. &amp;nbsp;Higher order
&lt;br&gt;programming based on call/N still has not found too widespread
&lt;br&gt;acceptance. &amp;nbsp;In fact, so far I have seen three different definitions
&lt;br&gt;of call/2 as built-in predicate in three systems that are incompatible
&lt;br&gt;with call/N. &amp;nbsp;Try call(functor(F,c), 0).
&lt;br&gt;&lt;br&gt;&lt;br&gt;Library lambda:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/lambda.pl&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/lambda.pl&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26489623&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Coding-Guidelines-for-Prolog-tp26439429p26489623.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26480612</id>
	<title>Windows VC9 runtime version issue</title>
	<published>2009-11-23T07:49:17Z</published>
	<updated>2009-11-23T07:49:17Z</updated>
	<author>
		<name>Jan Wielemaker-3</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I've got a bug-report for the Windows version that one needs the VC8
&lt;br&gt;runtime libraries. &amp;nbsp;See
&lt;br&gt;&lt;a href=&quot;http://gollem.science.uva.nl/bugzilla/show_bug.cgi?id=432&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gollem.science.uva.nl/bugzilla/show_bug.cgi?id=432&lt;/a&gt;&lt;br&gt;&lt;br&gt;Does anyone know how to deal with this in Microsoft land? In particular,
&lt;br&gt;can anyone propose a change to the NullSoft installerscript that takes
&lt;br&gt;an action that would make Windows users happy, such as giving the
&lt;br&gt;appropriate message or better, install the runtime for the poor soul.
&lt;br&gt;&lt;br&gt;You find the current installer script at
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.swi-prolog.org/git/pl.git?a=blob;f=src/win32/installer/pl.nsi&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.swi-prolog.org/git/pl.git?a=blob;f=src/win32/installer/pl.nsi&lt;/a&gt;&lt;br&gt;&lt;br&gt;(click pl.nsi there to get the raw file).
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thanks --- Jan
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26480612&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Windows-VC9-runtime-version-issue-tp26480612p26480612.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26480367</id>
	<title>RE: help with swi prolog program</title>
	<published>2009-11-23T07:37:39Z</published>
	<updated>2009-11-23T07:37:39Z</updated>
	<author>
		<name>Stiffler</name>
	</author>
	<content type="html">&lt;html&gt;
&lt;head&gt;

&lt;/head&gt;
&lt;body class='hmmessage'&gt;
&lt;font style=&quot;font-size: 10pt;&quot; size=&quot;2&quot;&gt;&quot;People think a programming paradigm is intuitive if that's the one the learned first&quot;&lt;br&gt;&lt;br&gt;&lt;/font&gt;I can't speak for others, but I learned imperative languages first (BASIC -&amp;gt; Assembler -&amp;gt; Ada -&amp;gt; C -&amp;gt; Glide ... -&amp;gt; Prolog -&amp;gt; ...).&amp;nbsp; At present, Prolog comes closest to my own &quot;internal&quot; way of expressing a problem.&amp;nbsp; I do not find imperative languages more intuitive,&amp;nbsp; in fact I find it frustrating to have to drop to a &quot;lower&quot; level of algorithm specification when I have to provide a step-by-step procedural specification.&lt;br&gt;&lt;br&gt;I hope one day to find a language based on first-order logic that is even more declarative (clause-order independence, classical negation).&amp;nbsp; Perhaps when answer-set programming matures it'll provide such a programming language.&lt;br&gt;&lt;br&gt;Parker&lt;br&gt;&lt;br&gt;&lt;hr id=&quot;stopSpelling&quot;&gt;Subject: RE: [SWIPL] help with swi prolog program&lt;br&gt;From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26480367&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gearoid.oneill@...&lt;/a&gt;&lt;br&gt;&lt;br&gt;






&lt;title&gt;RE: [SWIPL] help with swi prolog program&lt;/title&gt;



&lt;br&gt;

&lt;font size=&quot;2&quot;&gt;The first programming language I encountered was Algol 60 but I feel that Prolog is more 'intuitive', in so far as one could use such a term in relation to a programming language. However, i feel that the programming languages - rather like 'natural languages' - are not easily mastered and once one is learned, it would, in practical terms, tend to be be a person's preferred language.&lt;br&gt;
&lt;br&gt;
The hypothesis &quot;People think a programming paradigm is intuitive if&lt;br&gt;
that's the one the learned first&quot; seems plausible, and I would be&lt;br&gt;
interested to hear of any evidence against it.&lt;br&gt;
&lt;br&gt;
What I've heard from the Erlang people is that it's easier to teach&lt;br&gt;
Erlang (with concurrency and no assignment statements) to telecoms&lt;br&gt;
engineers who aren't programmers than it is to teach concurrency to&lt;br&gt;
people who _are_ (imperative or OO) programmers.&lt;br&gt;
&lt;br&gt;
_______________________________________________&lt;br&gt;
SWI-Prolog mailing list&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26480367&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;BR&gt; 		 	   		  &lt;br /&gt;&lt;hr /&gt;New Windows 7: Find the right PC for you. &lt;a href='http://windows.microsoft.com/shop' target='_new' rel=&quot;nofollow&quot;&gt;Learn more.&lt;/a&gt;&lt;/body&gt;
&lt;/html&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-help-with-swi-prolog-program-tp26437268p26480367.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26476308</id>
	<title>Re: help with swi prolog program</title>
	<published>2009-11-23T03:27:26Z</published>
	<updated>2009-11-23T03:27:26Z</updated>
	<author>
		<name>Eckard Brauer-3</name>
	</author>
	<content type="html">Hello Richard,
&lt;br&gt;&lt;br&gt;&amp;quot;Richard O'Keefe&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26476308&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ok@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;gt; I can't imagine such a language, neither as a programming nor a
&lt;br&gt;&amp;gt; &amp;gt; native language. For the native languages the last centuries of
&lt;br&gt;&amp;gt; &amp;gt; human evolution
&lt;br&gt;&amp;gt; &amp;gt; show that it's at least not quite easy to get one -- if I'm not told
&lt;br&gt;&amp;gt; &amp;gt; nonsense, most inuit languages are not very suited for describing
&lt;br&gt;&amp;gt; &amp;gt; the life of bush people in central africa, while central african
&lt;br&gt;&amp;gt; &amp;gt; languages don't very precise fit for the life of the Inuit. :D
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You were told nonsense.
&lt;br&gt;&amp;gt; The *vocabulary* of Inuit languages may not suit Central Africa,
&lt;br&gt;&amp;gt; but that's a trivial matter, easily amended in a generation.
&lt;br&gt;&amp;gt; The *grammar* of Inuit languages is well up to the job.
&lt;/div&gt;&lt;/div&gt;OK, I wasn't very precise here. But usually I learned (or tried to;
&lt;br&gt;maybe the number of tries is too small yet) another language, I had to
&lt;br&gt;pick up a few words first (vocabulary) and then had to start with
&lt;br&gt;grammar while continuously picking up more words, means: *practically*
&lt;br&gt;your very exact distinction is less useful.
&lt;br&gt;&lt;br&gt;Moreover, have you ever tried to automatically translate texts into a
&lt;br&gt;different language and back again (try a much different language like
&lt;br&gt;chinese or the like) or even transcribe english words/sentences to
&lt;br&gt;japanese script and let somebody read that? The result may not very
&lt;br&gt;well sell as english ;)
&lt;br&gt;&lt;br&gt;What I was trying to tell for programming language wasn't that any
&lt;br&gt;language is *useless* to implement a solution for a given problem (what
&lt;br&gt;indeed may be the case for special purpose languages ore special
&lt;br&gt;problems), but that a given language may be of *less use* for that on
&lt;br&gt;a general level because it will limit the set of generally possible
&lt;br&gt;solutions to a subset.
&lt;br&gt;&lt;br&gt;&amp;gt; English has picked up a lot of words from other languages.
&lt;br&gt;&amp;gt; New Zealanders are expected to know &amp;quot;iwi&amp;quot;, &amp;quot;whanua&amp;quot;, &amp;quot;wai&amp;quot;, &amp;quot;kai&amp;quot;,
&lt;br&gt;&amp;gt; &amp;quot;mana&amp;quot;, &amp;quot;kaumatua&amp;quot;, &amp;quot;runanga&amp;quot;, &amp;quot;tane&amp;quot;, &amp;quot;wahine&amp;quot;, &amp;quot;kuia&amp;quot;, &amp;quot;matua&amp;quot;,
&lt;br&gt;&amp;gt; &amp;quot;tamariki&amp;quot;, &amp;quot;reo&amp;quot;, &amp;quot;kohanga&amp;quot;, &amp;quot;maunga&amp;quot;, &amp;quot;awa&amp;quot;, &amp;quot;ringaringa&amp;quot;,
&lt;br&gt;&amp;gt; &amp;quot;whare&amp;quot;, oh, the list goes on, and I haven't covered plant names
&lt;br&gt;&amp;gt; (&amp;quot;kauri&amp;quot;, &amp;quot;matai&amp;quot;, &amp;quot;manuka&amp;quot;, ...) or bird names (&amp;quot;kiwi&amp;quot;, &amp;quot;weka&amp;quot;,
&lt;br&gt;&amp;gt; &amp;quot;pukeko&amp;quot;, ...) or fish names ... &amp;nbsp;It's something that happens
&lt;br&gt;&amp;gt; fairly quickly.
&lt;br&gt;&lt;br&gt;AFAIK what is sold under the name &amp;quot;english&amp;quot; in any part of the world
&lt;br&gt;can easily broken down into at least a lot of dialects and a few
&lt;br&gt;languages (this because of it's not only a matter of *vocabulary*,
&lt;br&gt;but also *grammar*).
&lt;br&gt;&lt;br&gt;If it were much different for programming languages, why then write
&lt;br&gt;style guides? Or what about predicate names in looksLikeJavaCamelCase?
&lt;br&gt;&lt;br&gt;&amp;gt; In programming languages, we are in fact seeing a Grand Convergence.
&lt;br&gt;&amp;gt; The designers of Ada originally rejected function pointers and
&lt;br&gt;&amp;gt; dot syntax for method calls; now it has them. &amp;nbsp;Eiffel picked up
&lt;br&gt;&amp;gt; closures (called &amp;quot;agents&amp;quot; in Eiffel), C++ is getting them, Java is
&lt;br&gt;&amp;gt; getting them, C# has them. &amp;nbsp;C# picked up the idea of higher order
&lt;br&gt;&amp;gt; functions on collections from Smalltalk and list comprehensions from
&lt;br&gt;&amp;gt; Haskell and crossed them with SQL to make LINQ, which is being picked
&lt;br&gt;&amp;gt; up by other languages.
&lt;br&gt;&lt;br&gt;That's how evolution works -- I was referring to a (any) given version
&lt;br&gt;of a (programming) language. In contrast to native languages most of
&lt;br&gt;them are at least semi-standardized (maybe only by single
&lt;br&gt;implementation). My theory is, that simply no such standard will fir
&lt;br&gt;for a really all-purpose programming language.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Eckard
&lt;br&gt;&lt;br /&gt; &lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;signature.asc&lt;/strong&gt; (205 bytes) &lt;a href=&quot;http://old.nabble.com/attachment/26476308/0/signature.asc&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-help-with-swi-prolog-program-tp26437268p26476308.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26473439</id>
	<title>Re: Line numbers in HTML parsing</title>
	<published>2009-11-22T22:45:07Z</published>
	<updated>2009-11-22T22:45:07Z</updated>
	<author>
		<name>Guy Wiener</name>
	</author>
	<content type="html">Thanks for the advice, Jan,
&lt;br&gt;&lt;br&gt;I think that there might be another way based on leaving the whitespaces 
&lt;br&gt;in the parsed tree and matching them. However, I couldn't find how to 
&lt;br&gt;pattern-match a newline character... Does anyone knows that?
&lt;br&gt;&lt;br&gt;&lt;br&gt;(The good solution is of course to hack the source, but that's going to 
&lt;br&gt;take a while...)
&lt;br&gt;&lt;br&gt;&lt;br&gt;Thank again,
&lt;br&gt;&lt;br&gt;&amp;nbsp; Guy Wiener.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Jan Wielemaker wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sun, 2009-11-22 at 13:35 +0200, Guy Wiener wrote:
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; Hello everyone,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I want to use the SWI library HTML parser (that is, the SGML/XML 
&lt;br&gt;&amp;gt;&amp;gt; parser), but I also need to get the line number for elements. For 
&lt;br&gt;&amp;gt;&amp;gt; example, instead of just getting
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;element(foo, [...], [...])&amp;quot;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I prefer
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;element(foo, LineNumber, [...], [...])&amp;quot;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Is there a way to get the line numbers of elements back from the library 
&lt;br&gt;&amp;gt;&amp;gt; parser?
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Only in call-back mode. &amp;nbsp;In normal mode you'd have to hack sgml2pl.c.
&lt;br&gt;&amp;gt; If you do so, my first option would be to add something that allows
&lt;br&gt;&amp;gt; adding the line-number as extra attributes to the attribute-list.
&lt;br&gt;&amp;gt; It is not really hard because all the information is available
&lt;br&gt;&amp;gt; AFAIK.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 	Cheers --- Jan
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; SWI-Prolog mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26473439&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26473439&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Line-numbers-in-HTML-parsing-tp26464545p26473439.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472994</id>
	<title>Re: Coding Guidelines for Prolog</title>
	<published>2009-11-22T21:23:48Z</published>
	<updated>2009-11-22T21:23:48Z</updated>
	<author>
		<name>Richard O'Keefe</name>
	</author>
	<content type="html">&lt;br&gt;On Nov 21, 2009, at 12:31 PM, &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472994&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rahelzer@...&lt;/a&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472994&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rahelzer@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; ins_bst(leaf,K, branch(leaf,K,leaf)).
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;One other thing. &amp;nbsp;Since this uses a BST to represent
&lt;br&gt;a set, I'd expect it to follow the naming convention
&lt;br&gt;for sets, which is
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;implementation tag&amp;gt;_add_element(+Set0, +Elt, -Set)
&lt;br&gt;so I'd expect it to be called bstset_add_element/3 and to
&lt;br&gt;live in a module devoted to such sets.
&lt;br&gt;&lt;br&gt;The Craft of Prolog mentions that the definition of a predicate
&lt;br&gt;often looks like the definition of its main argument type, but
&lt;br&gt;doesn't talk about &amp;quot;skeletons&amp;quot;, mainly because that's not how I
&lt;br&gt;think about code.
&lt;br&gt;&lt;br&gt;A skeletons approach could be very helpful IF you had a
&lt;br&gt;programming tool (not entirely unlike the transformation
&lt;br&gt;based program Martin Feather once wrote for either HOPE or
&lt;br&gt;NPL -- can't recall which) where you could state your
&lt;br&gt;starting point and the transformation steps and automatically
&lt;br&gt;replay the transformation process when one or the other of
&lt;br&gt;them changed.
&lt;br&gt;&lt;br&gt;There's been some relevant work in the Haskell community, but
&lt;br&gt;there they start from a higher order specification, which can
&lt;br&gt;commonly be related somehow to category theory, and just hit
&lt;br&gt;it with lots of optimisations, so that the code the programmer
&lt;br&gt;sees *is* the high level version, not the low level transformed
&lt;br&gt;version.
&lt;br&gt;&lt;br&gt;A lot of things can be done as folds and unfolds (in the
&lt;br&gt;functional programming sense, not the transformation sense).
&lt;br&gt;I'm going to ask about this in the Haskell Café, because I
&lt;br&gt;don't see how to do it myself.
&lt;br&gt;&lt;br&gt;For what it's worth, the Haskell code would be
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data BST k = Empty | NonEmpty (BST k) k (BST k)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert :: Ord k =&amp;gt; BST k -&amp;gt; k -&amp;gt; BST k
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert Empty x = BST Empty k Empty
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert (NonEmpty l m r) x =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case compare x m of
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LT -&amp;gt; BST (insert l x) m r
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GT -&amp;gt; BST l m (insert r x)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EQ -&amp;gt; BST l m r
&lt;br&gt;&lt;br&gt;where the type of the function could be inferred by the compiler,
&lt;br&gt;and the data type would be shared by all the functions. &amp;nbsp;So we're
&lt;br&gt;really talking about 6 lines of code.
&lt;br&gt;&lt;br&gt;I have a Prolog preprocessor that provides functional syntax,
&lt;br&gt;so this could be written as
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :- data leaf, bst(Less,Key,Greater).
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert(fork(L,K,G), X) | compare(C, X, K) -&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ( &amp;nbsp; C == (&amp;lt;) -&amp;gt; bst(insert(L,X),K,H)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; &amp;nbsp; C == (&amp;gt;) -&amp;gt; bst(L,K,insert(H,X))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; &amp;nbsp; C == (=) -&amp;gt; bst(L,K,G)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ).
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert(leaf, X) &amp;nbsp;-&amp;gt; bst(leaf,X,leaf).
&lt;br&gt;&lt;br&gt;from which the code I presented before results by
&lt;br&gt;(a) desugaring and (b) outlining the case as a predicate.
&lt;br&gt;&lt;br&gt;What, other than better variable names, would make code
&lt;br&gt;like this clearer?
&lt;br&gt;&lt;br&gt;One of the reasons I detest syntax colouring is that it usurps
&lt;br&gt;the use of colour for other purposes. &amp;nbsp;For example, you could
&lt;br&gt;use
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; black for the type case-analysis skeleton,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; blue for the ordering case-analysis skeleton,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; red for the result construction code.
&lt;br&gt;&lt;br&gt;I've actually seen something like this done on a large scale
&lt;br&gt;in the listing of a compiler. &amp;nbsp;Three or four logically separate
&lt;br&gt;passes had been folded into one, but the lines were coloured
&lt;br&gt;according to which pass they belonged to.
&lt;br&gt;&lt;br&gt;writing Prolog code using
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472994&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Coding-Guidelines-for-Prolog-tp26439429p26472994.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472745</id>
	<title>Re: help with swi prolog program</title>
	<published>2009-11-22T20:36:30Z</published>
	<updated>2009-11-22T20:36:30Z</updated>
	<author>
		<name>Richard O'Keefe</name>
	</author>
	<content type="html">&lt;br&gt;On Nov 23, 2009, at 1:37 PM, Marius Filip wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I agree regarding the role of paradigms in lifting many burdens off &amp;nbsp;
&lt;br&gt;&amp;gt; the
&lt;br&gt;&amp;gt; programmer's shoulders. But for reliable dealing with concurency a NEW
&lt;br&gt;&amp;gt; paradigm is needed, orthogonal to what currently exists (namely &amp;nbsp;
&lt;br&gt;&amp;gt; procedural,
&lt;br&gt;&amp;gt; functional, object-oriented, etc). Concurrency is a &amp;quot;new&amp;quot; problem &amp;nbsp;
&lt;br&gt;&amp;gt; which with
&lt;br&gt;&amp;gt; the advent of multi-cores puts enough pressure upon the industry &amp;nbsp;
&lt;br&gt;&amp;gt; calling for
&lt;br&gt;&amp;gt; a solution - in terms of paradigm - and the existing languages with &amp;nbsp;
&lt;br&gt;&amp;gt; their
&lt;br&gt;&amp;gt; multi-threading patchwork are not enough anymore.
&lt;/div&gt;&lt;br&gt;I was using a concurrent programming language back in the 1970s.
&lt;br&gt;It's NOT a new problem in any interesting sense. &amp;nbsp;(In fact, by
&lt;br&gt;1979 I had programmed in PL/I, Burroughs Algol, Simula 67, and
&lt;br&gt;Algol 68, all of which had some form of concurrency. &amp;nbsp;My Burroughs
&lt;br&gt;Algol programs _could_ have run on a multihead machine, although
&lt;br&gt;we happened not to have one. &amp;nbsp;Note the &amp;quot;67&amp;quot; and &amp;quot;68&amp;quot; in the names.)
&lt;br&gt;&lt;br&gt;I have no idea what a paradigm orthogonal to imperative, declarative,
&lt;br&gt;&amp;c might look like. &amp;nbsp;If you do, more power to you! &amp;nbsp;But it sounds very
&lt;br&gt;much like &amp;quot;it shouldn't make any difference to the imperative part&amp;quot;.
&lt;br&gt;Well, we _have_ one of those. &amp;nbsp;It's called LINDA. &amp;nbsp;There's more than
&lt;br&gt;one Linda implementation for Java.
&lt;br&gt;&lt;br&gt;It's hard to call Ada a &amp;quot;patchwork&amp;quot;; concurrency was designed into Ada
&lt;br&gt;from the outset. &amp;nbsp;(In the 1970s, in fact. &amp;nbsp;This is NOT a new problem.)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Concerning Prolog, my opinion is that it's not recoverable.
&lt;br&gt;&lt;br&gt;Fortunately, we have Mercury and Mozart/Oz, and there is prior art
&lt;br&gt;(some of it at Quintus) for an Erlang-like Prolog. &amp;nbsp;Indeed, there
&lt;br&gt;is a Prolog interpreter written in Erlang.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; A completely new
&lt;br&gt;&amp;gt; language blending the logical paradigm with the safe concurrent &amp;nbsp;
&lt;br&gt;&amp;gt; access a la
&lt;br&gt;&amp;gt; Erlang (or some other approach), yes. But a NEW language, not Prolog &amp;nbsp;
&lt;br&gt;&amp;gt; (not
&lt;br&gt;&amp;gt; surprisingly, Erlang is deterministic, no such thing as &amp;nbsp;
&lt;br&gt;&amp;gt; backtracking). That
&lt;br&gt;&amp;gt; language might look and feel like Prolog, just as C++ still looks &amp;nbsp;
&lt;br&gt;&amp;gt; and feels
&lt;br&gt;&amp;gt; like &amp;quot;C with classes&amp;quot; - but it would be quite different in nature.
&lt;/div&gt;&lt;br&gt;The C++ I'm seeing these days does not look like C with classes.
&lt;br&gt;(Except for one of my colleagues, who insists on using it so,
&lt;br&gt;because he's red hot keen on writing programs that just work,
&lt;br&gt;rather than using the latest and greatest of anything.)
&lt;br&gt;C++ these days, thanks to things like BOOST, looks like macro
&lt;br&gt;processing on steroids, and doesn't really feel like C at all.
&lt;br&gt;A very nice example of how adding one feature can change the
&lt;br&gt;character of a language dramatically.
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472745&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-help-with-swi-prolog-program-tp26437268p26472745.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26471010</id>
	<title>RE: help with swi prolog program</title>
	<published>2009-11-22T16:05:53Z</published>
	<updated>2009-11-22T16:05:53Z</updated>
	<author>
		<name>Gearóid Ó Néill</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 3.2//EN&quot;&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=iso-8859-1&quot;&gt;
&lt;META NAME=&quot;Generator&quot; CONTENT=&quot;MS Exchange Server version 6.5.7654.12&quot;&gt;
&lt;TITLE&gt;RE: [SWIPL] help with swi prolog program&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;!-- Converted from text/plain format --&gt;
&lt;BR&gt;

&lt;P&gt;&lt;FONT SIZE=2&gt;The first programming language I encountered was Algol 60 but I feel that Prolog is more 'intuitive', in so far as one could use such a term in relation to a programming language. However, i feel that the programming languages - rather like 'natural languages' - are not easily mastered and once one is learned, it would, in practical terms, tend to be be a person's preferred language.&lt;BR&gt;
&lt;BR&gt;
The hypothesis &amp;quot;People think a programming paradigm is intuitive if&lt;BR&gt;
that's the one the learned first&amp;quot; seems plausible, and I would be&lt;BR&gt;
interested to hear of any evidence against it.&lt;BR&gt;
&lt;BR&gt;
What I've heard from the Erlang people is that it's easier to teach&lt;BR&gt;
Erlang (with concurrency and no assignment statements) to telecoms&lt;BR&gt;
engineers who aren't programmers than it is to teach concurrency to&lt;BR&gt;
people who _are_ (imperative or OO) programmers.&lt;BR&gt;
&lt;BR&gt;
_______________________________________________&lt;BR&gt;
SWI-Prolog mailing list&lt;BR&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471010&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;&lt;BR&gt;
&lt;A HREF=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/A&gt;&lt;BR&gt;
&lt;BR&gt;
&lt;BR&gt;
&lt;/FONT&gt;
&lt;/P&gt;

&lt;/BODY&gt;
&lt;/HTML&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-help-with-swi-prolog-program-tp26437268p26471010.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26470861</id>
	<title>Re: Coding Guidelines for Prolog</title>
	<published>2009-11-22T15:45:01Z</published>
	<updated>2009-11-22T15:45:01Z</updated>
	<author>
		<name>Richard O'Keefe</name>
	</author>
	<content type="html">&lt;br&gt;On Nov 21, 2009, at 12:31 PM, &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470861&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rahelzer@...&lt;/a&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470861&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rahelzer@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; ins_bst(leaf,K, branch(leaf,K,leaf)).
&lt;br&gt;&amp;gt; ins_bst(branch(L1,K1,R1),K, T) :-
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( (K @&amp;lt; K1) -&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ins_bst(L1,K,L2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T=branch(L2,K1,R1)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; &amp;nbsp; ( (K == K1) -&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T = branch(L1,K1,R1)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; ins_bst(R1,K,R2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T = branch(L1,K1,R2)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;).
&lt;/div&gt;&lt;br&gt;(A) it's pretty obviously insertion into a binary search tree
&lt;br&gt;(B) it's rather ugly (those extra (...) around comparisons, the
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;indentation that puts things at the same conceptual level
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at differnt physical levels).
&lt;br&gt;&lt;br&gt;Let's rewrite.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %- type bst(K) ---&amp;gt; leaf | branch(bst(K),K,bst(K)).
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %- pred ins_bst(+bst(K), +K, ?bst(K)).
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % &amp;nbsp; ins_bst(+BST0, +Key, -BST1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % &amp;nbsp; is true when BST0 represents some set S0 as a
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % &amp;nbsp; binary search tree and BST1 is the result of
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % &amp;nbsp; inserting Key into S0 without rebalancing.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % &amp;nbsp; BST1 represents S0 U {Key}.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(leaf, Key, branch(leaf,Key,leaf).
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(branch(L,K,R), Key, BST) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; compare(Order, Key, K),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(Order, Key, BST, L, K, R).
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(&amp;lt;, Key, branch(L1,K,R), L0, K, R) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(L0, Key, L1).
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(&amp;gt;, Key, branch(L,K,R1), L, K, R0) :-
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(R0, Key, R1).
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ins_bst(=, _, &amp;nbsp; branch(L,K,R), &amp;nbsp;L, K, R).
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; program which used it), I had no idea what it meant or whether it had
&lt;br&gt;&amp;gt; a bug in it or not.
&lt;br&gt;&lt;br&gt;That's funny, because when I looked at it, it was _obvious_ what
&lt;br&gt;it meant.
&lt;br&gt;&amp;gt; Well, how much plainer could it be? Its only 11 lines of code,
&lt;br&gt;&amp;gt; and the indentation style is sane.
&lt;br&gt;&lt;br&gt;No, the indentation style is not good.
&lt;br&gt;The code above, using an auxiliary predicate, is 9 lines.
&lt;br&gt;&lt;br&gt;Don't forget, two of the recommendations are
&lt;br&gt;&amp;nbsp; - use brief but helpful variable names
&lt;br&gt;&amp;nbsp; - provide header comments.
&lt;br&gt;&lt;br&gt;&amp;gt; %% &amp;nbsp;insert_binary_search_tree(*T0,*K,*T1)
&lt;br&gt;&lt;br&gt;No, &amp;quot;*&amp;quot; is wrong here. &amp;nbsp;*T0, *K, maybe, although
&lt;br&gt;+K would be more typical. &amp;nbsp;But -T1.
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; % &amp;nbsp;inserts the prolog term K into a binary binary
&lt;br&gt;&lt;br&gt;It's pointless to say that K is a Prolog term.
&lt;br&gt;Every Prolog term is a Prolog term.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; % &amp;nbsp;search tree T0, yielding T1
&lt;br&gt;&amp;gt; insert_binary_search_tree(leaf,K, branch(leaf,K,leaf)).
&lt;br&gt;&amp;gt; insert_binary_search_tree(branch(L1,K1,R1),K, T) :-
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( (K @&amp;lt; K1) -&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;insert_binary_search_tree(L1,K,L2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T=branch(L2,K1,R1)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; &amp;nbsp; ( (K == K1) -&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T = branch(L1,K1,R1)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; insert_binary_search_tree(R1,K,R2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T = branch(L1,K1,R2)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;).
&lt;/div&gt;&lt;br&gt;This leaves the variable names and the wonky indentation
&lt;br&gt;and the asymmetric presentation unchanged.\
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470861&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Coding-Guidelines-for-Prolog-tp26439429p26470861.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26470689</id>
	<title>Re: help with swi prolog program</title>
	<published>2009-11-22T15:18:56Z</published>
	<updated>2009-11-22T15:18:56Z</updated>
	<author>
		<name>Richard O'Keefe</name>
	</author>
	<content type="html">&lt;br&gt;On Nov 21, 2009, at 4:46 AM, Eckard Brauer wrote:
&lt;br&gt;&amp;gt; I can't imagine such a language, neither as a programming nor a native
&lt;br&gt;&amp;gt; language. For the native languages the last centuries of human &amp;nbsp;
&lt;br&gt;&amp;gt; evolution
&lt;br&gt;&amp;gt; show that it's at least not quite easy to get one -- if I'm not told
&lt;br&gt;&amp;gt; nonsense, most inuit languages are not very suited for describing the
&lt;br&gt;&amp;gt; life of bush people in central africa, while central african languages
&lt;br&gt;&amp;gt; don't very precise fit for the life of the Inuit. :D
&lt;br&gt;&lt;br&gt;You were told nonsense.
&lt;br&gt;The *vocabulary* of Inuit languages may not suit Central Africa,
&lt;br&gt;but that's a trivial matter, easily amended in a generation.
&lt;br&gt;The *grammar* of Inuit languages is well up to the job.
&lt;br&gt;&lt;br&gt;English has picked up a lot of words from other languages.
&lt;br&gt;New Zealanders are expected to know &amp;quot;iwi&amp;quot;, &amp;quot;whanua&amp;quot;, &amp;quot;wai&amp;quot;, &amp;quot;kai&amp;quot;,
&lt;br&gt;&amp;quot;mana&amp;quot;, &amp;quot;kaumatua&amp;quot;, &amp;quot;runanga&amp;quot;, &amp;quot;tane&amp;quot;, &amp;quot;wahine&amp;quot;, &amp;quot;kuia&amp;quot;, &amp;quot;matua&amp;quot;,
&lt;br&gt;&amp;quot;tamariki&amp;quot;, &amp;quot;reo&amp;quot;, &amp;quot;kohanga&amp;quot;, &amp;quot;maunga&amp;quot;, &amp;quot;awa&amp;quot;, &amp;quot;ringaringa&amp;quot;,
&lt;br&gt;&amp;quot;whare&amp;quot;, oh, the list goes on, and I haven't covered plant names
&lt;br&gt;(&amp;quot;kauri&amp;quot;, &amp;quot;matai&amp;quot;, &amp;quot;manuka&amp;quot;, ...) or bird names (&amp;quot;kiwi&amp;quot;, &amp;quot;weka&amp;quot;,
&lt;br&gt;&amp;quot;pukeko&amp;quot;, ...) or fish names ... &amp;nbsp;It's something that happens
&lt;br&gt;fairly quickly.
&lt;br&gt;&lt;br&gt;In programming languages, we are in fact seeing a Grand Convergence.
&lt;br&gt;The designers of Ada originally rejected function pointers and
&lt;br&gt;dot syntax for method calls; now it has them. &amp;nbsp;Eiffel picked up
&lt;br&gt;closures (called &amp;quot;agents&amp;quot; in Eiffel), C++ is getting them, Java is
&lt;br&gt;getting them, C# has them. &amp;nbsp;C# picked up the idea of higher order
&lt;br&gt;functions on collections from Smalltalk and list comprehensions from
&lt;br&gt;Haskell and crossed them with SQL to make LINQ, which is being picked
&lt;br&gt;up by other languages.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;SWI-Prolog mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470689&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;SWI-Prolog@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-help-with-swi-prolog-program-tp26437268p26470689.html" />
</entry>

</feed>
