Re: iterator strings as lists?
- To: mathgroup at smc.vnet.net
- Subject: [mg3538] Re: [mg3495] iterator strings as lists?
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Thu, 21 Mar 1996 01:09:21 -0500
- Sender: owner-wri-mathgroup at wolfram.com
purswell at netplus.net (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]
{2,3,4,5}
Allan Hayes
hay at haystack.demon.co.uk
==== [MESSAGE SEPARATOR] ====