harder parts of list
- To: mathgroup at smc.vnet.net
- Subject: [mg15570] harder parts of list
- From: Arnold Knopfmacher <arnoldk at gauss.cam.wits.ac.za>
- Date: Tue, 26 Jan 1999 13:44:48 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
This seems to be a harder list parts problem. Given a list like lst={{4,2,3,1},{3,1,5},{2,4,3}} I wish to select the elements in each sublist that are smaller than the first entry in that sublist. So for the above lst the output should be {{2,3,1},{1},{}}. How can I do this with Select or Cases? Using pattern matching this works rule1={a_,b___,c_,d___}:>{a,b,d} /;c>a (# //. rule1)& /@ lst {{4,2,3,1},{3,1},{2}} Rest /@ % {{2,3,1},{1},{}} Thanks Arnold Knopfmacher Wiws University South Africa