Re: To create {{},{},....{}} beyond $MaxRecursionLimit
- To: mathgroup at smc.vnet.net
- Subject: [mg46731] Re: To create {{},{},....{}} beyond $MaxRecursionLimit
- From: "Hans Michel" <hansjm at bellsouth.net>
- Date: Wed, 3 Mar 2004 02:30:40 -0500 (EST)
- References: <c238e9$igj$1@smc.vnet.net>
- Reply-to: "Hans Michel" <hansjm at bellsouth.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
In[1]:=
Table[{},{i,4}]
Out[1]=
{{},{},{},{}}
I don't know what else you may want.
You probably get tons of examples from the group.
Here is another
PadLeft[{},4,"{}"], Although, this one is not equivalent to Table the Head
the elements is String not List.
PadLeft[{},4,List[{}]] All Heads are list. So is PadRight[{},4,List[{}]]
hans
"János" <janos.lobb at yale.edu> wrote in message
news:c238e9$igj$1 at smc.vnet.net...
> Hi,
>
> I am in need of creating a nested list in the form of {{},{},....{}}
> of arbitrary length where none of the sublists have any element in it.
> I came up with
>
> lst = NestList[List, {},lengthlist - 1]
>
> For[i = 2, i <=
> lengthlist, i++, flt = Table[{j}, {j, i, lengthlist}]; lst =
> FlattenAt[lst, flt]]
>
> however it complains when lengthlen is over $MaxRecursionLimit. I see
> that I can change that Limit to Infinity, but I rather would not go
> that route. It must be a better way without using NestList.
>
> Any good hint ?
>
> Thanks ahead,
>
> János
> -------------------------------------------------
> clear perl code is better than unclear awk code; but NOTHING comes
> close to unclear perl code
> http://www.faqs.org/faqs/computer-lang/awk/faq/
>