Re: Re: If-statement problems

• To: mathgroup at smc.vnet.net
• Subject: [mg49646] Re: [mg49638] Re: If-statement problems
• From: DrBob <drbob at bigfoot.com>
• Date: Mon, 26 Jul 2004 04:01:50 -0400 (EDT)
• References: <cdlj0l\$83c\$1@smc.vnet.net> <200407250655.CAA07592@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```> Apparently A[[1]] = e will have the effect of assigning e to a and not
> leaving "a" alone and setting A to {e, b, c, d}.

No, not really. Here are examples of doing it both ways:

Clear[a,b,c,d,e,m]
m={a,b,c,d}
m[[1]]=e
{a,m}

{a,b,c,d}

e

{a,{e,b,c,d}}

Clear[a,b,c,d,e,m]
m={a,b,c,d}
Evaluate[m[[1]]]=e
{a,m}

{a,b,c,d}

e

{e,{e,b,c,d}}

Bobby

On Sun, 25 Jul 2004 02:55:48 -0400 (EDT), Aaron Fude <aaronfude at yahoo.com> wrote:

>
> Thank you to all who answered.
>
> And the right answer is....  "if" vs. "If".
>
> Special thanks to those, who realized that my "a, b, c, d" example was just
> a demo for my problem and not a real attempt to assign values to a b c and
> d. But at the same time {a, b, c, d} = {1, 2, 3, 4} was a suprizing
> construct which raised another question.
>
> Supose A = {a, b, c, d} and I want to replace the first element with "e".
> Apparently A[[1]] = e will have the effect of assigning e to a and not
> leaving "a" alone and setting A to {e, b, c, d}. How would I accomplish the
> latter and not the former?
>
> Thanks!
>
> Aaron Fude
>
>
>

--
DrBob at bigfoot.com
www.eclecticdreams.net

```

• Prev by Date: GraphSum ignores edge colors?
• Next by Date: Re: Re: NonlinearFit works not so good
• Previous by thread: Re: If-statement problems
• Next by thread: Re: If-statement problems