Re: split a list
- To: mathgroup at smc.vnet.net
- Subject: [mg40585] Re: split a list
- From: Bill Rowe <listuser at earthlink.net>
- Date: Thu, 10 Apr 2003 03:42:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 4/9/03 at 1:30 AM, rlbrambilla at cesi.it (Roberto Brambilla) wrote: >I have a list (very long, thousands, and unsorted) of numbers >r={n1,n2...} and for a given a number m I want to split it in the two >sublists (unsorted, same order) u={elements<m], v={elements>m}. Now I >use this *old-style* method: Since Select preserves order in the selection simply do m = Select[r, #<m&] v = Select[r, #>m&]