MathGroup Archive 1996

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

Search the Archive

Re: iterator strings as lists?

  • To: mathgroup at
  • Subject: [mg3538] Re: [mg3495] iterator strings as lists?
  • From: Allan Hayes <hay at>
  • Date: Thu, 21 Mar 1996 01:09:21 -0500
  • Sender: owner-wri-mathgroup at

purswell at (J.P. and/or Valerie Purswell)
>Subject: [mg3495] iterator strings as lists?
Query the following sort of behaviour

	iter = {i, 1, 5};
	Table[i, iter]

	Table::itform: Argument iter at position 2
     	does not have the correct form for an iterator.
		Table[i, iter]

The reason for this is that Table has the attribute HoldAll, so it  
does not evaluate iter

You can deal with this kind of problem by using Evaluate:

	Table[i, Evaluate[iter]]

		{1, 2, 3, 4, 5}
Take does not have the attribute HoldAll so we get
	tk = {2,5};
	temp = Table[i, {i, 1, 5}];
	Take[temp, tk]

Allan Hayes
hay at


  • Prev by Date: Re:Generating inverse functions
  • Next by Date: Re: Complex-valued contour integrals
  • Previous by thread: Re: iterator strings as lists?
  • Next by thread: Re: Re: iterator strings as lists?