🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3164

Programming Quickie

#3164
From: Ian Dickinson
Date: Fri, 25 Mar 1988 16:21
30 lines
1494 bytes
This is a little problem that I encountered today,  that, whilst I have
thought of a number of solutions, none of them seem to be very neat or
particularly efficient.

Here is the problem...

Assume a relation "Y is contained in X", specified as:
	contains( ?X, ?Y ).

Assume also, two global predicates p/1 and q/1. (As is always the case in 
these problems, p and q are expensive to compute :-).

The problem is to define a predicate exactly_one/2:

	exactly_one( +X, ?Y )
	is true if X contains Y,  Y satisfies p/1 and all of the other
	Y' contained by X satisfy q/1.

Any offers?

Thanks in advance,
Ian.

+-------------------------------------------------------------------------+
|Ian Dickinson,           Hewlett Packard Laboratories,  Bristol,  England|
|net: ijd@hplb.uucp   ijd%idickins@hplabs.HP.COM     ..!mcvax!ukc!hplb!ijd|
|"I've been to every single book I know               +-------------------+
| To soothe the thoughts that plague me so"  -Sting   | voice: 0272-799910|
|Nevertheless,  my opinions are entirely my own fault |                   |
+-----------------------------------------------------+-------------------+
Technical Details
Message-ID: <1600011@otter.hple.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!ncar!ames!lll-lcc!pyramid!hplabs!otter!ijd

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!ncar!ames!lll-lcc!pyramid!hplabs!otter!ijd
From: ijd@otter.hple.hp.com (Ian Dickinson)
Newsgroups: comp.lang.prolog
Subject: Programming Quickie
Message-ID: <1600011@otter.hple.hp.com>
Date: 25 Mar 88 16:21:37 GMT
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Lines: 30