Re: delete something from a complex list
- To: mathgroup at smc.vnet.net
- Subject: [mg58096] Re: [mg58075] delete something from a complex list
- From: János <janos.lobb at yale.edu>
- Date: Sat, 18 Jun 2005 06:07:48 -0400 (EDT)
- References: <200506170920.FAA07915@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Jun 17, 2005, at 5:20 AM, mark wrote:
>
> hi
> how to delete numbers 1 and 2 from the multilevel nested list,
> while preserving the structure:
> {{{{1,3,2,4}},{{5,2}}},{{4,2},{6,1,7}}}
> i hope the result is:
> {{{{3,4}},{{5}}},{{4},{6,7}}}
> i have tried delete with no success but after i have flatten the list.
> thanks
>
>
In[1]:=
lst = {{{{1, 3, 2, 4}},
{{5, 2}}}, {{4, 2},
{6, 1, 7}}}
Out[1]=
{{{{1, 3, 2, 4}}, {{5, 2}}},
{{4, 2}, {6, 1, 7}}}
In[2]:=
Delete[lst, Join[Position[
lst, 1], Position[lst,
2]]]
Out[2]=
{{{{3, 4}}, {{5}}},
{{4}, {6, 7}}}
János
--------------------------------------------
f @@ # & /@ === f @@@
- References:
- delete something from a complex list
- From: mark <rotree2003@yahoo.com>
- delete something from a complex list