[m-dev.] for review: add `do_while/4' to std_util.m

Ralph Becket rbeck at microsoft.com
Wed Oct 20 19:19:38 AEST 1999

Just one point...

> :- pred q(int::out, int::out) is nondet.
> q(X, Y) :-
> 	p(X),
> 	(if some [Y1] p(Y1) then
> 		Y = Y1
> 	else
> 		Y = 42
> 	).

I find the quantification here a tad confusing.  My intuition says that
the quantification `some [Y1]' has scope just in the condition of the
if-then-else - which would make `Y1' free in the then clause - but it
clearly extends into the then clause.  I would write this along the
lines of

	Y = some [Y1] (if p(Y1) then Y1 else 42)

I know it's just some test code; I just want to know if Fergus' code is
the `correct' idiom and, if so, why?


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