Re: Tracing with out using trace?



Markus Triska wrote:

What about:

grandparent([Grandparent,Parent,Child]) :-
parent(Grandparent, Parent),
parent(Parent, Child).

Yielding:

?- grandparent(Ls).

Ls = [gramps, homer, bart] ;

and generalising the drawing bit to handle such extended relations
represented as lists? You can keep the old rule as well and use it to
draw the corresponding binary relation.

That would work for a specific degree of relationship. Suppose though that I wished to define a rule "is_related_to". Distant cousins of varying degrees will have a variable number of names in the result list which could not necessarily be tied back to the right relationship.

Or friend-of-friend where there could be any number of connections before getting to a final person?

Regards,

--
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email
.



Relevant Pages

  • Re: Tracing with out using trace?
    ... to worry about my drawing bit. ... parent(Parent, Child). ... and generalising the drawing bit to handle such extended relations ...
    (comp.lang.prolog)
  • Printing outside of excel and selecting printers
    ... I have been trying to develop a macro that I can embed into a whole ... bunch of existing Drawing register files. ... which have lists of upto 50 ... list of available printers. ...
    (microsoft.public.excel.programming)
  • Re: How do you format data that is part of a drop down menu?
    ... All you have to do is "unhide" the ... lists. ... Just add a name to whichever list you're drawing from. ... When you select a cell does an Arrow appear at right side of the cell with the ...
    (microsoft.public.excel.misc)
  • WinAPI within Excel 2003 Printer selector
    ... I have been trying to develop a macro that I can embed into a whole ... bunch of existing Drawing register files. ... which have lists of upto 50 ... list of available printers. ...
    (microsoft.public.vb.winapi)
  • Re: PartNumbers compare and re-list
    ... Why not just use worksheet function like MATCH and ISERROR to generate your ... NickHK ... > I am working with Drawing Numbers. ... I have four lists: ...
    (microsoft.public.excel.programming)