OPERATOR ^ 
Author Message
 OPERATOR ^

Could someone help me, please?
This piece of Prolog program is part of a production
system found in Yoav Shoham's book "Artificial
Intelligence Techniques in Prolog".
I don't understand the use of operator "^". None
tip is found in this book. Could someone help me?

conflictset(CS):-
 bagof0((SortedTagList-(If,Then,S,F)),
     TagList^STagList^(pr(If, (Then,S,F)),
       triggered(If, TagList),
       quicksort(TagList,STagList),
       reverse(STagList,SortedTagList),
       not(fired(If,Then,SortedTagList))),
     CS).

Thanks in advance!

Antonio Carlos Melonio.
Universidade de Sao Paul
Sao Paulo- SP
 Brazil



Fri, 16 Jul 1999 03:00:00 GMT  
 OPERATOR ^


Quote:
>Could someone help me, please?
>This piece of Prolog program is part of a production
>system found in Yoav Shoham's book "Artificial
>Intelligence Techniques in Prolog".
>I don't understand the use of operator "^".
>conflictset(CS):-
> bagof0((SortedTagList-(If,Then,S,F)),
>     TagList^STagList^(pr(If, (Then,S,F)),
>       triggered(If, TagList),
>       quicksort(TagList,STagList),
>       reverse(STagList,SortedTagList),
>       not(fired(If,Then,SortedTagList))),
>     CS).

The caret sign is used by Prolog as an existential operator.
Yoav Shoham didn't need to tell you about it because it is
a normal feature of all Edinburgh-compatible Prologs and *ought*
to be clearly described in the manual for the Prolog system you
are using.

Myself, I wouldn't dream of writing such a complex generator.
Nor am I silly enough to use falsely so-called "quick" sort.
I'd have something like

        conflict_set(CSet) :-
            bagof(C, find_conflict(C), CSet).

        find_conflict(Downsorted_Tag_List - (If,Then,S,F)) :-
            pr(If, (Then,S,F)),
            trigged(If, Tag_List),
            sort(Tag_List, Upsorted_Tag_List),
            reverse(Upsorted_Tag_List, Downsorted_Tag_List),
            \+ fired(If, Then, Downsorted_Tag_List).

What the existential quantifier does is to tell the all-solutions
operator that you are not interested in TagList and STagList so it
isn't to bother remembering or binding them to solutions.

The rule of thumb I use is to make the generator a single literal
whenever I reasonably can.  It has kept me out of a lot of trouble.

--
limits on the scope of cooperation are often due to the inability
to recognise the identity or the acts of the other playes.  --R.Axelrod
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.



Fri, 23 Jul 1999 03:00:00 GMT  
 OPERATOR ^


Quote:
> This piece of Prolog program is part of a production
> system found in Yoav Shoham's book "Artificial
> Intelligence Techniques in Prolog".
> I don't understand the use of operator "^". None
> tip is found in this book. Could someone help me?

    Have a look at:

http://www.clip.dia.fi.upm.es/~logalg/slides/97_3_prolog_language/nod...

--
        Manuel Carro

           ||         Manuel Carro -- CLIP Group         ||

           ||    http://www.clip.dia.fi.upm.es/~boris    ||
           || Phone: +34 1 336-7448  FAX: +34 1 352-4819 ||



Mon, 26 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. operator overloading and user definable operators.

2. Overloading logical operators and bitwise operators

3. OPERATOR (was: Why no ** operator in Modula2?)

4. Aliases for operators, creating new operators

5. Operator overload of base operator and compiler diagnostic

6. Is there a reverse operator to the '%' operator on string ?

7. Creating collections - dynamic list operator {...}

8. Creating collections - dynamic list operator - braces

9. NY/SIGAPL meeting 2/23/95: Brickman on Operators

10. Retrieving the name of defined operator operands

11. what does J operator #: do?

12. Triadic Operators in J?

 

 
Powered by phpBB® Forum Software