[m-dev.] Implicit quantification

Peter Schachte schachte at csse.unimelb.edu.au
Mon Jan 15 14:00:21 AEDT 2007


Zoltan Somogyi wrote:
> On 14-Jan-2007, Ben Schmidt <b.schmidt at ugrad.unimelb.edu.au> wrote:

>> (	some [A] ( A="Cat" ; A="Dog" )
>> ->	A="Mouse"
>> ;	A="Canary"
>> )

> That is not a bug. A "some" in the condition of an if-then-else extends
> to the then-part of the if-then-else as well.
>  
> The syntax may be a bit misleading, but it isn't our syntax; we inherited it
> from NU-Prolog. I don't think anyone has proposed any better syntax.

That's more than "a bit" misleading.  Syntactically, it's very clear that the
some extends only to the condition.  So does this mean there's no way in
mercury to existentially quantify a variable only to the condition when an
identically named variable appears in the then branch?

I'd argue that

	(   some [A] ( A="Cat" ; A="Dog" -> A="Mouse" )
	;   A="Canary"
	)

would be clearer syntax for what Mercury interpreted Ben's example to mean.

This doesn't really matter that much, since it's easy enough for the programmer
to just rename the variables apart.  But then, by the same token, we don't
really need some/2 at all.

-- 
Peter Schachte              'Might makes right,' and hoary folly totters on
schachte at cs.mu.OZ.AU        in her mad career escorted by armies and navies.
www.cs.mu.oz.au/~schachte/      -- Adin Ballou, 1846
Phone: +61 3 8344 1338
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list