MathGroup Archive 1998

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

Search the Archive

Re: Re: Is this a bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13459] Re: [mg13386] Re: Is this a bug?
  • From: "Jurgen Tischer" <jtischer at col2.telecom.com.co>
  • Date: Fri, 24 Jul 1998 01:45:43 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

No bug, forced order of evaluation:

In[1]:=
If[True,Evaluate[ToExpression["x=5"]],Evaluate[ToExpression["y=5"]]]//Trace

Out[1]=
{{ToExpression["x=5"],{x=5,5},5},{ToExpression["y=5"],{y=5,5},5},If[True,5,5
],
  5}

Jurgen

-----Original Message-----
From: jfreeze at lexmark.com <jfreeze at lexmark.com> To:
mathgroup at smc.vnet.net
Subject: [mg13459] [mg13386] Re: Is this a bug?


>
>The following seems to be a bug. In the first example, both the true and
>the false parts of If are being evaluated. In the secon example, only
>the true part. If this is not a bug, could someone please explain this
>behavior to me. Thanks
>
>In[1]:=
>     Clear[x,y];
>
>If[True,Evaluate[ToExpression["x=5"]],Evaluate[ToExpression["y=5"]]];
>     Print[x,y];
>Out[1]:=
>     55
>In[2]:=
>     Clear[x,y];
>     If[True,x=5,y=5];
>     Print[x,y];
>Out[2]:=
>     5y
>
>



  • Prev by Date: Re: writing programs
  • Next by Date: Re: tag Times protected??
  • Previous by thread: Re: Is this a bug?
  • Next by thread: Re: Re: Re: Is this a bug?