MathGroup Archive 1996

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

Search the Archive

Re: How to get rid of the outer {}?


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



  • Prev by Date: Making C-code
  • Next by Date: Solution of diff. equation i the form of list?
  • Previous by thread: Re: How to get rid of the outer {}?
  • Next by thread: Re: How to get rid of the outer {}?