MathGroup Archive 2005

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

Search the Archive

Re: delete something from a complex list


lst = {{{{1, 3, 2, 4}}, {{5, 2}}}, {{4, 2}, {6, 1, 7}}};
lst /. (1 | 2) :> Sequence[]
{{{{3, 4}}, {{5}}}, {{4}, {6, 7}}}

Sequence[] is just an empty argument sequence, which is eliminated.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: mark [mailto:rotree2003 at yahoo.com]
To: mathgroup at smc.vnet.net


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




  • 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