From jan@swi.psy.uva.nl Fri Feb 23 10:06:29 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f1N96TZ18625;
	Fri, 23 Feb 2001 10:06:29 +0100 (MET)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id KAA04515;
	Fri, 23 Feb 2001 10:06:28 +0100
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: "Bernd Fischer" <fisch@ptolemy.arc.nasa.gov>,
   "SWI Prolog (list)" <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] choicepoints from flag/3
Date: Fri, 23 Feb 2001 10:00:35 +0100
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <NDBBLGANCLGPPKPLENDJKEFOCKAA.fisch@ptolemy.arc.nasa.gov>
In-Reply-To: <NDBBLGANCLGPPKPLENDJKEFOCKAA.fisch@ptolemy.arc.nasa.gov>
MIME-Version: 1.0
Message-Id: <01022310062801.04449@gollem>
Content-Transfer-Encoding: 8bit

On Fri, 23 Feb 2001, Bernd Fischer wrote:
>Hi,
>
>using flag/3 leaves my with unwanted (and redundant) choicepoints which I
>can't cut away. Look at:
>
>1 ?- flag(test, _, 1).
>
>Yes
>2 ?- flag(test, X, X).
>
>X = 1 ;
>
>No.
>3 ?- once(flag(test, X, X)).
>
>X = 1 ;
>
>No.
>
>
>Is there any way around it? Or do I understand something fundamentally wrong
>here?

Yes.  There is no choice-point, but the toplevel always provides you
with the `;' option if there is an answer that binds a named variable
(i.e. any variable except _).

Actually it would not be impossible for the toplevel to verify that
an answer is fully deterministic and say `Yes' right away.  I don't know
whether that is an improvement as it requires more careful reading of
Prolog's feedback (now it says `No' and gives the prompt or a binding
and you'll type ; or RETURN).

If you want more information on determinism, use the GUI tracer
(provided with 4.0.0) or use the 'A' answer in the tracer.

	--- Jan

