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

• To: mathgroup at smc.vnet.net
• Subject: [mg5616] Re: [mg5574] Re: [mg5562] Re: [mg5507] How to get rid of the outer {}?
• From: Allan Hayes <hay at haystack.demon.co.uk>
• Date: Fri, 27 Dec 1996 23:43:43 -0500
• Sender: owner-wri-mathgroup at wolfram.com

```Andrei Constantinescu <constant at athena.polytechnique.fr>
Subject: [mg5616] [mg5574] Re:  [mg5562] Re: [mg5507] How to get rid of the
outer {}?

Andrei

The clue is what happens before Outer is evaluated:
Using A in place of outer we get

mylist = {{0,1}, {0,1}, {0,1}, {0,1}};

A[List,Sequence[mylist]]	(*Sequence disappears*)

A[List, {{0, 1}, {0, 1}, {0, 1}, {0, 1}}]

A[List,Apply[Sequence,mylist]] (*List mylist becomes a sequence*)

A[List, {0, 1}, {0, 1}, {0, 1}, {0, 1}]

A[Sequence[mylist]]	  (*Sequence disappears*)

A[{{0, 1}, {0, 1}, {0, 1}, {0, 1}}]

Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk

*******************
Forwarded message

... one little remark about Outer , Sequence & the question !

There are two possibilities about applying Sequence:

In[5]:= mylist = {{0,1}, {0,1}, {0,1}, {0,1}}

Out[5]= {{0, 1}, {0, 1}, {0, 1}, {0, 1}}

In[6]:= Outer[ List , Sequence[mylist] ]

Out[6]= {{{0}, {1}}, {{0}, {1}}, {{0}, {1}}, {{0}, {1}}}

... which is not the good answer, :-) , and :

In[9]:= Outer[ List, Apply[Sequence,mylist] ]

Out[9]= {{{{{0, 0, 0, 0}, {0, 0, 0, 1}}, {{0, 0, 1, 0}, {0, 0, 1, 1}}},

>     {{{0, 1, 0, 0}, {0, 1, 0, 1}}, {{0, 1, 1, 0}, {0, 1, 1, 1}}}},

>    {{{{1, 0, 0, 0}, {1, 0, 0, 1}}, {{1, 0, 1, 0}, {1, 0, 1, 1}}},

>     {{{1, 1, 0, 0}, {1, 1, 0, 1}}, {{1, 1, 1, 0}, {1, 1, 1, 1}}}}}

.... which is what we'd like to have !

Unfortunately, I'm not capable of explaining why this happens, by may be
someone else could, :-) !

Another try did:

In[2]:= mylist = {List, {0,1}, {0,1}, {0,1}, {0,1}}

Out[2]= {List, {0, 1}, {0, 1}, {0, 1}, {0, 1}}

In[3]:= Outer[Sequence[mylist]]

Outer::argmu: Outer called with 1 argument; 2 or more arguments are
expected.

... which seems also to be strange. I couldn't stop this happen
using Release
or Evaluate, which might be a question of the inner functiong of
Outer ???

Cheers,

Andrei

```

• Prev by Date: Re: lighten plots
• Next by Date: Re: Reading tables with labels
• Previous by thread: Re: How to get rid of the outer {}?
• Next by thread: Q: Function for volume calculation