how to sort integers and sparsearrays ?

• To: mathgroup at smc.vnet.net
• Subject: [mg71954] how to sort integers and sparsearrays ?
• Date: Wed, 6 Dec 2006 06:03:32 -0500 (EST)

```Hi,

I have a list of a form

list = {k, {SparseArray[],SparseArray[], {A,SparseArray[]}}}

A is integer, k is list

What to do to convert it to

{{k,A},{SparseArray[],SparseArray[],SparseArray[]}}

The length of list is unknown. We don't know where A appears. We only
know that it is integer and forms a list {A, SparseArray[]}.

I can't just use

list/.{a___,{b_,c_,{d_,e_}}}

because this pattern will not suit nither to e.g

list2=  {{0,3}},
{{A,SparseArray[]},SparseArray[],SparseArray[],SparseArray[],SparseArray[]}

nor

list3=  {{0,3}},
{SparseArray[],SparseArray[],SparseArray[],SparseArray[],SparseArray[]}

where there is no A at all.

Help,

Arek

```

• Prev by Date: Histogram3D
• Next by Date: System of Linear Equations
• Previous by thread: Re: Re: Histogram3D
• Next by thread: Re: how to sort integers and sparsearrays ?