MathGroup Archive 2010

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

Search the Archive

Re: Two questions related to Arrays


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




  • Prev by Date: Color Function example?
  • Next by Date: Re: From list to list of arguments
  • Previous by thread: Two questions related to Arrays
  • Next by thread: Re: Two questions related to Arrays