MathGroup Archive 2003

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

Search the Archive

Re: Part assignment

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44983] Re: [mg44972] Part assignment
  • From: Andrzej Kozlowski <andrzejK at platon.c.u-tokyo.ac.jp>
  • Date: Fri, 12 Dec 2003 04:41:20 -0500 (EST)
  • References: <200312111028.FAA13125@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 11 Dec 2003, at 19:28, Maxim wrote:

> Consider
>
> In[1]:=
> Module[
>   {L={0,0}},
>   L[[1]]=Sequence[1,1];
>   L[[2]]=2;
>   L[[2]]
> ]
>
> Out[1]=
> 1
>
> The first part assignment constructs a list {Sequence[1,1],0}. Then an
> interesting thing happens: part extraction functions (Part and others)
> think that the second element of this list is 1, while part assignment
> (Set) decides that the second element is 0.
>

But what is wrong with that? After all, this just depends on 
understanding the order of evaluation. When you replace the first part 
of L by Sequence[1,1] it stays in this form until L is  evaluated. 
Since L is not evaluated in your case you get the answer 1. But


Module[{L = {0, 0}},
   L[[1]] = Sequence[1, 1];
    L = L; L[[2]] = 2; L[[2]]]

2

Both of these answers are perfectly in order and understandable to 
anyone who understands the order of evaluation here. So what exactly is 
your point?

Andrzej

PS. Is there any reason why you  use a fake Warsaw University Math 
Institute address as your "spam decoy"? 


  • Prev by Date: Re: Part assignment
  • Next by Date: Re: Maybe it's me but the integrator at wolfram doesn't work very well
  • Previous by thread: Re: Part assignment
  • Next by thread: Re: Part assignment