Re: A question about pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg53835] Re: [mg53815] A question about pattern
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 29 Jan 2005 06:02:43 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
How about... rule = {a___, b_, c_, d___} /; c > b -> {a, 2, b, 3, c, d}; list = {{a, 1, 2, d}, {a, 2, 1, d}, {1, 2}, {2, 1}}; list /. rule {{a, 2, 1, 3, 2, d}, {a, 2, 1, d}, {2, 1, 3, 2}, {2, 1}} David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Daohua Song [mailto:ds2081 at columbia.edu] To: mathgroup at smc.vnet.net Dear Group, I am just struggling by the following question: I want to build a rule like this, List/.{a___,b_,c_?(#>b&),d___}->{a,2 b,3 c,d} But it doesn't work. please help me! Thanks DHSONG