Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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




  • 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