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: [mg58093] Re: delete something from a complex list
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 18 Jun 2005 06:07:45 -0400 (EDT)
  • References: <d8u6sd$8mo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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


Here is yet another way to do the job:

{{{{1,3,2,4}},{{5,2}}},{{4,2},{6,1,7}}}/.{1->Sequence[],
     2->Sequence[]}

I guess I just like Sequence - it lets you do so many neat tricks!

David Bailey
http://www.dbaileyconsultancy.co.uk



  • Prev by Date: Did something change?
  • 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