Re: Two questions related to Arrays
- To: mathgroup at smc.vnet.net
- Subject: [mg113330] Re: Two questions related to Arrays
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 23 Oct 2010 07:09:05 -0400 (EDT)
On 10/22/10 at 1:35 AM, sam.takoy at yahoo.com (Sam Takoy) wrote:
>First, why doesn't the following return the first two elements of
>the outer list:
>Cases[{{{1}, {2}}, {3, 4}, {{5}, 6}}, _Array]
This returns an empty list because nothing in what you supply
has head Array. Every thing is either a list or an integer in
your example.
Cases[{{{1}, {2}}, {3, 4}, {{5}, 6}}, _List]
will return the entire list since it matches the pattern.
Cases[{{{1}, {2}}, {3, 4}, {{5}, 6}}, _?ArrayQ]
will return the first two elements