I don't think that ' if not ((a in X) or (b in X)) then...' is correct.

Basically the if statement will fail if there is anything in the X other than A 
or B.

Ie X = []  or [a] or [b] or [a,b] will succeed
X = [c] or [a, c] etc will fail

I would suggest

If (X = []) or (X = [a]) or (x = [b]) or (X = [a,b]) then...

But the original code seems fine to me.

Regards

Sean Cross
IT Systems Development Manager

Catalyst Risk Management
PO Box 230
50 Dalton St
Napier 4140
DDI: 06-8340362
mobile: 021 270 3466
Visit us at http://www.catalystrisk.co.nz/

Offices in Auckland, Napier, Wellington & Christchurch

Disclaimer:
"The information contained in this document is confidential to the addressee(s) 
and may be legally privileged. Any view or opinions expressed are those of the 
author and may not be those of Catalyst Risk Management. No guarantee or 
representation is made that this communication is free of errors, viruses or 
interference. If you have received this e-mail message in error please delete 
it and notify me. Thank you."


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:delphi-talk-
> [EMAIL PROTECTED] On Behalf Of Dan Kloke
> Sent: Wednesday, 18 April 2007 12:21 p.m.
> To: Delphi-Talk Discussion List
> Subject: Re: Question on Set operator
>
> the original code can be read as:
>
> "if removing both a and b from X leaves the empty set, then..."
>
> or could be recoded as:
>
> if not ((a in X) or (b in X)) then...
>
> [EMAIL PROTECTED] wrote:
> > Hi All,
> >
> > I've inherited some code that I need to integrate into some existing
> > code.  The author of the old code is using a construct I don't
> > understand.  There are things like:
> >
> >     if (X - [a, b]) = [] then ...
> >
> > where "X" is a set and "a" and "b" are valid members of that set.  My
> > understanding of sets is that this should be the same as:
> >
> >     if (a in X) or (b in X) then...
> >
> > but it isn't, because if I replace the first "if" with the second,
> > the program behavior changes.
> >
> > Can someone help me with my conceptual gap and explain what the first
> > "if" is saying?  Thanks.
> >
> >
> > Regards,
> > Sid Gudes
> > PIA Systems Corporation
> > [EMAIL PROTECTED]
> >
> >
> > __________________________________________________
> > Delphi-Talk mailing list -> Delphi-Talk@elists.org
> > http://www.elists.org/mailman/listinfo/delphi-talk
> __________________________________________________
> Delphi-Talk mailing list -> Delphi-Talk@elists.org
> http://www.elists.org/mailman/listinfo/delphi-talk
__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to