[m-dev.] Suggestion for a new "where" operator
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Aug 7 12:52:56 AEST 2003
On 07-Aug-2003, Peter Moulder <pmoulder at mail.csse.monash.edu.au> wrote:
> `q((X where p(X)), (X where p(X)))' has the same declarative semantics
> as `some[V] (V = (X where p(X)), q(V, V))' regardless of the number of
> elements in {X : p(X)}.
>
> p(X), p(X), q(X, X) (duplicate-where version)
Well, it depends on what scoping rules we choose for "where" expressions.
I expected the scoping rules for `where' to be the same as if the code
had been written using `apply((func) = X :- p(X))' instead of `(X where p(X))'.
In that case, if there are no other occurrences of X outside the call
to q/2, then then two occurrences of X would be in different scopes, so
the semantics would be
some [X] (p(X), V1 = X),
some [X] (p(X), V2 = X),
q(V1, V2)
which is different than the semantics for the single-where version.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- 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