Re: Tracing with out using trace?
- From: Bruce Horrocks <news@xxxxxxxxxxxxxxxxx>
- Date: Sun, 03 Sep 2006 14:40:59 +0100
Markus Triska wrote:
It's easy to derive the corresponding binary relation.
That wasn't a good example by me. Suppose the relationships are son_of and daughter_of, e.g.
son_of(homer, bart).
daughter_of(homer, lisa).
daughter_of(homer, maggie).
Now suppose I try to identify siblings by rule:
sibling([P, X, Y]) :-
son_of(P, X),
son_of(P, Y),
X \== Y.
sibling([P, X, Y]) :-
daughter_of(P, X),
daughter_of(P, Y),
X \== Y.
sibling([P, X, Y]) :-
son_of(P, X),
daughter_of(P, Y).
sibling([P, X, Y]) :-
daughter_of(P, X),
son_of(P, Y).
Not very elegant, I realise, but the print procedure does not know whether to label the P-->X line on the graph with "son_of" or "daughter_of" as they could be in either order.
Again, I realise that this can be coded around but I was hoping to avoid putting such restrictions on the user created rules by being able to duplicate trace and so "know" which link is being followed.
Does this make it clearer?
Regards,
--
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email
.
- Follow-Ups:
- Re: Tracing with out using trace?
- From: Markus Triska
- Re: Tracing with out using trace?
- References:
- Tracing with out using trace?
- From: Bruce Horrocks
- Re: Tracing with out using trace?
- From: Markus Triska
- Re: Tracing with out using trace?
- From: Bruce Horrocks
- Re: Tracing with out using trace?
- From: Markus Triska
- Tracing with out using trace?
- Prev by Date: Re: Tracing with out using trace?
- Next by Date: Re: Mainstream Prolog
- Previous by thread: Re: Tracing with out using trace?
- Next by thread: Re: Tracing with out using trace?
- Index(es):
Relevant Pages
|