🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #594

Re: Duplicate Solutions

#594
From: Ken Johnson
Date: Thu, 15 Mar 1990 17:55
30 lines
1298 bytes
In article <11500023@hpldola.HP.COM> patch@hpldola.HP.COM (Pat Chkoreff) writes:
>Occasionally I have written a predicate that yields duplicate solutions, and
>I've wondered how to make each solution occur uniquely.  For example, I have
>a multigraph:
>
>	node(X).             % X is a node.
>	edge(E, X, Y).       % E is a directed edge from node X to node Y.


Instead, try

	n_edges(X, Y, [E1,E2,E3...]).

E1 is a directed edge that goes from X to Y; so are E2, E3 etc.

	n_edges(X, Y, []).

unnecessary, but would mean that X and Y are not connected. Then

	joined(X,Y) :-
		n_edges(X,Y,[_|_]).

True if X and Y are joined.


-- 
Ken Johnson, AI Applications Institute, 80 South Bridge, Edinburgh EH1 1HN
E-mail ken@aiai.ed.ac.uk, phone 031-225 4464 extension 212
`I have read your article, Mr Johnson, and I am no wiser now than when I
started'.  -- `Possibly not, sir, but far better informed.'
Technical Details
Message-ID: <2060@skye.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!edcastle!aiai!ken
References: <11500023@hpldola.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!edcastle!aiai!ken
From: ken@aiai.ed.ac.uk (Ken Johnson)
Newsgroups: comp.lang.prolog
Subject: Re: Duplicate Solutions
Message-ID: <2060@skye.ed.ac.uk>
Date: 15 Mar 90 17:55:50 GMT
References: <11500023@hpldola.HP.COM>
Reply-To: ken@aiai.UUCP (Ken Johnson)
Organization: AIAI, University of Edinburgh, Scotland
Lines: 30