Subject: Re: [SWIPL] choicepoints from flag/3

From: Jan Wielemaker <[email-masked]>
Date: Fri, 23 Feb 2001 10:00:35 +0100

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