Re: Global predicates in SWI and Sicstus Prolog

From: Christoph Quix (cqx_at_gmx.de)
Date: 08/23/04


Date: Mon, 23 Aug 2004 12:35:36 +0200

Bart Demoen wrote:
> :- use_module('file2.pl',[bar/1]).
Ok, that avoids the error message, but it does not make
the predicate global, it just defines another predicate
bar/1 in module test. Look at the following output:

| ?- foo(X).
X = z ? ;
no
| ?- assert(bar(x)).
yes
| ?- foo(X).
X = z ? ;
no
| ?- assert(test:bar(x)).
yes
| ?- foo(X).
X = z ? ;
X = x ? ;
no

So, if I would use the same directive in a second module,
the predicates would be different.

Regards,
  Christoph

P.S.:
> ps. look in the SICStus manual - it took me about 1 minute to come up
> with the above - I didn't know this beforehand
I did, and I checked a few possible solutions by examples.
But nothing really worked so far.



Relevant Pages

  • Re: Prolog - Displaying Error Messages
    ... error message to the user if something fails inside a predicate, ... This produces the error message (you may have something ... the concept of exceptions before learning Prolog. ...
    (comp.lang.prolog)
  • Re: Unable to save state.
    ... told me (clicking on the source file). ... stand along exec file for my French classes. ... it issues that error message that I ... declare something related to prolog_file_type/2 predicate. ...
    (comp.lang.prolog)
  • runtime Error.. cant assign value to this object
    ... i get an error message that says Runtime error 2448 " you cant assign a ... Dim strWhere As String ... 'Add it to the predicate - exact match ...
    (microsoft.public.access.formscoding)
  • Re: Prolog - Displaying Error Messages
    ... error message to the user if something fails inside a predicate, ... In the xupdate/2 predicate, if PName contains a bad value then Call ... obviously fails and returns No. ...
    (comp.lang.prolog)
  • Prolog - Displaying Error Messages
    ... error message to the user if something fails inside a predicate, ... In the xupdate/2 predicate, if PName contains a bad value then Call ... obviously fails and returns No. ...
    (comp.lang.prolog)