[mercury-users] hi & a feq queries
Thomas Charles CONWAY
conway at cs.mu.OZ.AU
Wed Aug 19 08:16:29 AEST 1998
Donald Syme, you write:
> The (small) problem that made me go check out the manual (and subsequently
> led to my stupid question) was switch detection when existentials
> guard the cases, e.g. :
> :- module junk.
> :- interface.
> :- import_module list.
> :- pred h(list(int) :: in, int :: out) is det.
> :- implementation.
> h(A,B) :- (A = , B = 1 ;
> (some [H,T] (A = [H|T], B = 2))).
> I guess I only do this sort of thing in generated
> code, and I can get around it by lifting the "some" up above the
> switch (taking a union of all variables in all the patterns).
I'm not sure, but I think we may have fixed this in the development
version. In any case, the use of existential quantifiers is almost
always unnecessary, since variables are implicitly existentially
quantified to their smallest enclosing scope. For instance, they
are unnecessary in the code you show above.
Thomas Conway <conway at cs.mu.oz.au>
Nail here  for new monitor. )O+
More information about the users