[m-dev.] for review: improve documentation of if-then-else
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Oct 7 22:40:35 AEST 1999
Estimated hours taken: 0.5
doc/reference_manual.texi:
Improve the documentation for if-then-else.
This change is in response to a suggestion from
Don Smith <dsmith at now.cirl.uoregon.edu> that we
say in the reference manual that Mercury's if-then-else
(in contrast to Prolog) does not prune away all but the
first solution of condition.
Workspace: /d-drive/home/hg/fjh/mercury
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.153
diff -u -r1.153 reference_manual.texi
--- doc/reference_manual.texi 1999/10/03 04:17:17 1.153
+++ doc/reference_manual.texi 1999/10/07 12:40:13
@@ -500,6 +500,16 @@
@var{CondGoal}, @var{ThenGoal}, and @var{ElseGoal} must be valid goals.
Note that the ``else'' part is @emph{not} optional.
+The declarative semantics of an if-then-else is given by
+ at code{( @var{CondGoal}, @var{ThenGoal} ; not(@var{CondGoal}), @var{ElseGoal})},
+but the operational semantics are different, and it is treated
+differently for the purposes of determinism inference (@pxref{Determinism}).
+Operationally, it executes the @var{CondGoal}, and if that succeeds, then
+execution continues with the @var{ThenGoal}; otherwise, i.e. if @var{CondGoal}
+fails, it executes the @var{ElseGoal}. Note that @var{CondGoal} can be
+nondeterministic -- unlike Prolog, Mercury's if-then-else does not commit
+to the first solution of the condition if the condition succeeds.
+
@item @code{@var{Term1} = @var{Term2}}
A unification.
@var{Term1} and @var{Term2} must be valid data-terms.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list