Re: function to check if array is empty

*To*: mathgroup at smc.vnet.net*Subject*: [mg88384] Re: function to check if array is empty*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Sat, 3 May 2008 06:18:50 -0400 (EDT)

On 5/1/08 at 3:22 AM, willpowers69 at hotmail.com (will parr) wrote: >i'm looking for a function to return either True (or 1), or False >(or 0) when it checks an array. eg: >X = Array[0 &, {3, 3}] >then test with function (called ArrayEmpty, for example) >In: ArrayEmpty[X] >Out: True I would not consider an array where every element is zero an empty array. For a truly empty array emptyArrayQ[x_] := Flatten@x == {} for an array where every element is zero zeroArrayQ[ x_] := {} == (SparseArray[x] /. HoldPattern[SparseArray[_, _, _, {_, {_, a_}, b_}]] :> Flatten@{a, b})