MathGroup Archive 2005

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

Search the Archive

Re: A question about pattern


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




  • Prev by Date: Re: A question about pattern
  • Next by Date: Re: A question about pattern
  • Previous by thread: Re: Re: A question about pattern
  • Next by thread: Re: A question about pattern