Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Array

  • To: mathgroup at
  • Subject: [mg69239] Re: [mg69220] Array
  • From: Andrzej Kozlowski <akoz at>
  • Date: Sun, 3 Sep 2006 23:46:23 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 3 Sep 2006, at 06:39, Bruce Colletti wrote:

> The command:
>    {A[1], A[2], A[3]} = {1, 2, 3}
> assigns a value to each A-variable.  However, the command:
>    Array[A,3] = {1,2,3}
> generates an error message.
> What is the difference between the two lines?
> Thankx.

> Bruce

Set (=) works in a special way when you make assignments to lists, as  
stated in the Help:

"lhs = rhs evaluates rhs and assigns the result to be the value \
of lhs. From then on, lhs is replaced by rhs whenever it appears.  
{l1, l2, \
... } = {r1, r2, ... } evaluates the ri, and assigns the results to  
be the \
values of the corresponding li.

This is why your first example works. However, since  Set does not  
evaluate its first argument, it tries to assign a rule to the symbol  
Array, which it can't do since Array is Protected. Hence what you  
should use is:


which will work exactly as the first example.

Andrzej Kozlowski

  • Prev by Date: Re: Array
  • Next by Date: comboboxes and paste to notebook
  • Previous by thread: Re: Array
  • Next by thread: Re: Array