Re: Finding pattern Matched series
- To: mathgroup at smc.vnet.net
- Subject: [mg33075] Re: Finding pattern Matched series
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 1 Mar 2002 06:51:27 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <a5ht5a$hrq$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, for the first pattern with {{q1_, x_}, {x_, q2_}} and 1<=q1<=6 the command should work Select[Partition[T, 2, 1], (MatchQ[#, {{_, x_}, {x_, _}}] && 1 <= First[First[#]] <= 6) &] the second pattern would be {{q1_, x_}, {x_, y_}, {y_, q2_}} Select[Partition[T, 3, 2], (MatchQ[#, {{q1_, x_}, {x_, y_}, {y_, q2_}}] && 1 <= First[First[#]] <= 6)&] and so on. Regards Jens Jari Curty wrote: > > Dear Mathgroup, > > Here is the problem: > > Given the following list T = {{1, 2}, {3, 4}, {2, 3}, {5, 6}, {4, 5}, {6, > 4}, {4, 1}} extract ALL the series of the following form: > > {{#, x_}, {x_, #}} > {{#, x_}, {x_, y_}, {y_, #}} > {{#, x_}, {x_, y_}, {y_, z_}, {z_, #}} > etc... > > for the for the value # in Range[Max[T]]. > > I guess it is a subtle mixture between Patterns and Maps but I can see it :- > ( > > Thanks for your appreciated help! > > Jari