Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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 @@@


  • Prev by Date: Re: delete something from a complex list
  • Next by Date: Re: delete something from a complex list
  • Previous by thread: Re: delete something from a complex list
  • Next by thread: Re: delete something from a complex list