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: [mg24014] Re: And, Or, Intersection, Union - no Orderless attribute
  • From: hwolf at debis.com
  • Date: Tue, 20 Jun 2000 03:07:31 -0400 (EDT)
  • Organization: debis Systemhaus
  • References: <8ikcli$qgu@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Drago Ganic schrieb:
> 
> 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

Hello Drago,

"And" not only has a logical meaning, but also a procedural semantics.
See this example:

In[4]:=
a := (Print["-false-"]; False);
b := (Print["-true-"]; True); c := (Print["-true-"]; True);

In[6]:= b && c && a
>From In[6]:=
"-true-"
>From In[6]:=
"-true-"
>From In[6]:=
"-false-"
Out[6]= False

In[7]:= a && b && c
>From In[7]:=
"-false-"
Out[7]= False

Now:

In[8]:= Unprotect[And]
In[9]:= SetAttributes[And, Orderless]

In[10]:= b && c && a
>From In[10]:=
"-false-"
Out[10]= False

So Orderless would destroy this (important!) behaviour.

Kind regards,
	Hartmut Wolf



  • Prev by Date: Re: Subscripted local variables in Module
  • Next by Date: imposing side conditions on Solve
  • Previous by thread: And, Or, Intersection, Union - no Orderless attribute
  • Next by thread: Re: And, Or, Intersection, Union - no Orderless attribute