Re: How to get rid of the outer {}?
- To: mathgroup at smc.vnet.net
- Subject: [mg5527] Re: [mg5507] How to get rid of the outer {}?
- From: "w.meeussen" <w.meeussen at solair4b.eunet.be>
- Date: Thu, 19 Dec 1996 01:02:29 -0500
- Sender: owner-wri-mathgroup at wolfram.com
At 19:26 14-12-96 -0500, you wrote:
>Hi,
>
>I wish to use a command like
>
>Outer[ List, {0,1}, {0,1}, {0,1}, {0,1}]
>
>but with 30 (or more) times {0,1} instead of four.
>I can easily generate such a list by Table[ {0,1}, {30}]
>however it has an additional {}. How I can use this list
>in Outer?
>
>Thank you in adavnce,
>Zvi Wiener
>
>
>
hi Zvi,
in principle, two ways:
by the applying the undocumented function 'Sequence' :
Outer[List,Sequence @@ Table[{0,1},{4}]]
or with a pure function with the 'sequence-dummy' ## :
Outer[List,##]& @@ Table[{0,1},{4}]
but wait, are you shure you want to generate the 2^30 = 1,073,741,824 first
integers, packaged two by two in a list, those lists two by two in an other
list, those ... etc ? That's quite a lot of bytes & brackets !
Can your computer hardware handle that?
Allow me to make a wild guess ...
If you need a binary representation of the first n integers, leading zero's
included, use
Rest /@ IntegerDigits[ Range[2^n,2 2^n -1] ,2]
this gives it without all the brackets.
But even there, 2^30 is a LOT !
Wouter.
Dr. Wouter L. J. MEEUSSEN
w.meeussen at solair4b.eunet.be