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: Set of strings reducing problem (Again!)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60369] Re: Set of strings reducing problem (Again!)
  • From: "dkr" <dkrjeg at adelphia.net>
  • Date: Wed, 14 Sep 2005 03:27:40 -0400 (EDT)
  • References: <dg69pb$a96$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

To avoid the problem pointed out by Stephen Layland, you can make a
simple amendment to the pattern as indicated below:
In[18]:=
cl=
{{"1","1","1","1"},{"1","1","1","X"},{"1","1","2","1"},{"1","1","2",

"X"},{"1","1","X","1"},{"1","1","X","X"},{"1","2","1","1"},{"1","2",

"1","X"},{"1","2","2","1"},{"1","2","X","1"},{"1","X","1","1"},{"1",
        "X","1","X"},{"1","X","2","1"},{"1","X","X","1"},{"2","1","1",

"1"},{"2","1","1","X"},{"2","1","2","1"},{"2","1","X","1"},{"2","2",

"1","1"},{"2","X","1","1"},{"X","1","1","1"},{"X","1","1","X"},{"X",

"1","2","1"},{"X","1","X","1"},{"X","2","1","1"},{"X","X","1","1"}};
r = Dispatch[{"1" + "X" -> "D",
         "1" + "2" -> "M",
         "1" + "U" -> "T",
         "X" + "2" -> "U",
         "X" + "M" -> "T",
         "2" + "D" -> "T"}];
ncl=StringJoin@@@(cl//.{x___List,{a___,p_String,c___},
            z___List,{a___,q_String,c___},

y___List}\[RuleDelayed]{x,{a,p+q/.r,c},z,y}/;StringQ[p+q/.r])

Out[20]=
{11TD,1U1D,1UU1,U11D,U1U1,UU11}


  • Prev by Date: Re: Re: Hardware question
  • Next by Date: Re: High precision NIntegrate problem. Please help!
  • Previous by thread: Re: Set of strings reducing problem (Again!)
  • Next by thread: Re:Re: Set of strings reducing problem (Again!)