Re: [eclipse-users] Simple question on example in Tutorial

From: Andrew Cheadle <amc4_at_doc.ic.ac.uk>
Date: Wed, 02 May 2007 21:16:28 +0100
Hi Chuck,

Can I give you a hint, what about defining a predicate 'disjunction':

disjunction(X,Y) :- call(X).
disjunction(X,Y) :- call(Y).

Now, how about declaring 'disjunction' to be an infix operator, and 
obviously 'disjunction' should bind its arguments weakly:

:- local op(1190, xfy, disjunction).

I can now define the 'disjunction' predicate as:

X disjunction Y :- call(X).
X disjunction Y :- call(Y).

try it out!

Does that help ;-)

Cheers

Andy

Lutz, Charles D wrote:
>
> Hi folks,
>
> I’m looking at the example for “Call” (Section 3.7.3 of “A Tutorial 
> Introduction”,
>
> v 21 Apr 2007) and I’m missing the point about how this defines 
> disjunction:
>
> X ; Y :- call(X).
>
> X ; Y :- call(Y).
>
> Each of these disjunction clauses seems to be formed by two other clauses,
>
> one just being “X” and the other being the implication of Y by either 
> a call(X)
>
> or call(Y).
>
> Or is it that the entire “left side” (“X ; Y”, for example) is implied 
> by the right
>
> side? As I am fairly new to ECLiPSe / Prolog, something of the syntax here
>
> escapes me. Any further explanation would be greatly appreciated. From a
>
> different text I thought I recalled that Prolog “Head :- Body” clauses 
> are Horn
>
> clauses, so there should only be one structure in the Head, but I could be
>
> wrong.
>
> Thanks!
>
> **Chuck Lutz**
>
> Lockheed Martin
>
> Systems of Systems Engineering
>
> BMC4I Modeling and Simulation
>
> Moorestown, NJ
>
> (856)638-7234 (office)
>
> charles.d.lutz_at_lmco.com <mailto:charles.d.lutz_at_lmco.com>
>
> “A graphic is never an end in itself; it is a moment
>
> in the process of decision making.”
> - Jacques Bertin
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_crosscoreop.com
> http://www.crosscoreop.com/mailman/listinfo/eclipse-users
>   


-- 
*********************************************************************
*  Andrew Cheadle                    email:  a.cheadle_at_doc.ic.ac.uk *
*  Department of Computing           http://www.doc.ic.ac.uk/~amc4/ *
*  Imperial College London                                          *
*********************************************************************
Received on Wed May 02 2007 - 21:16:37 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET