MathGroup Archive 1996

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

Search the Archive

Re: Re: iterator strings as lists?

  • To: mathgroup at
  • Subject: [mg3557] Re: [mg3528] Re: iterator strings as lists?
  • From: Richard Mercer <richard at>
  • Date: Mon, 25 Mar 1996 21:32:14 -0500
  • Sender: owner-wri-mathgroup at

Dave Wagner wrote, in reference to the HoldAll attribute of Table,

>  I don't know what the design rationale for this is.  It
>  seems to me like Table could get by with the HoldFirst
>  attribute, but maybe there's some pathological case of
>  which we're not aware that precludes this.

There is undoubtedly more than one reason, but one at least is not so  
pathological. Table allows you to use as an index a variable that  
already has an assigned value.

j = 8;

{{1, 2}, {2, 4}, {3, 6}}

If the HoldAll attribute is removed, this feature is lost.

Attributes[Table] = {HoldFirst};

Table::itraw: Raw object 8 cannot be used as an iterator.
Table[i j, {i, 1, 3}, {8, 1, 2}]

This situation also occurs with Plot. Plot has the HoldAll attribute so  
that the following command produces the expected graph with no  

x = 8;

These features are essential for non-expert users, who assign values to  
commonly used variables with reckless abandon (experts know better).
If you don't see yourself having this particular problem, my guess is  
that changing the HoldAll attribute to HoldFirst would not cause any  
serious problems.

Richard Mercer


  • Prev by Date: Re: ListContourPlot: AxesLabels? (Q)
  • Next by Date: mathematica-macppp conflict
  • Previous by thread: Re: iterator strings as lists?
  • Next by thread: Re: iterator strings as lists?