Path: utzoo!mnetor!uunet!munnari!mulga!lee From: lee@mulga.oz (Lee Naish) Newsgroups: comp.lang.prolog Subject: Re: Programming Quickie Message-ID: <2644@mulga.oz> Date: 30 Mar 88 07:51:50 GMT References: <1600011@otter.hple.hp.com> Reply-To: lee@mulga.UUCP (Lee Naish) Organization: Comp Sci, Melbourne Uni, Australia Lines: 13 In article <1600011@otter.hple.hp.com> ijd@otter.hple.hp.com (Ian Dickinson) writes: > 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. % NU-Prolog solution (will generate X or Y or both) exactly_one(X, Y) :- solutions(Y0, X contains Y0, YList), % like setof delete(Y, YList, Remainder), p(Y), all Y1 member(Y1, Remainder) => q(Y1). % any formatting ideas? lee