Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: And, Or, Intersection, Union - no Orderless attribute

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24009] Re: And, Or, Intersection, Union - no Orderless attribute
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 20 Jun 2000 03:07:28 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8ikcli$qgu@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

yes -- And[] and Or[] are used in constructs known als
conditons, If[] statements ..

When

test1 &&  test2 && test3

and test1 gives False test2 and test3 are not evaluated.
So the ordering of testi *is* verry important just try

$A=Table[0,{255}]

saveMaxInA[index_Integer,val_]:=If[index>=1 && index<=255 &&
val>$A[index],$A[index]=val]

and

saveMaxInA[345,1]

the above code does nothing, reversing the order to

val>$A[index] && index<=255 && index>=1

will give some funny error messages.
The same apply to Or[] when one of the first tests
is true the remaining are skipped.

Regards
  Jens

Drago Ganic wrote:
> 
> Hi Mathgroup !!
> 
> Is there any reason that the symbols
> 
>     And,
>     Or,
>     Intersection,
>     Union
> 
> do not have the Orderless attribute (but do have the Flat attribute).
> 
> These operations are commutative (as far as I know). We can see this fo And and Or if we use LogicalExpand
> 
> In[1]:        b && c && a
> Out[1]:     b && c && a
> 
> In[2]:        LogiclaExpand[%]
> Out[2]:     a && b && c
> 
> Why, why ??
> 
> Drago Ganic
> Croatia


  • Prev by Date: imposing side conditions on Solve
  • Next by Date: Re: User problem
  • Previous by thread: Re: And, Or, Intersection, Union - no Orderless attribute
  • Next by thread: Re: And, Or, Intersection, Union - no Orderless attribute