Finding pattern Mached series

• To: mathgroup at smc.vnet.net
• Subject: [mg33089] Finding pattern Mached series
• From: "Juan" <erfa11 at hotmail.com>
• Date: Fri, 1 Mar 2002 06:52:05 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi, Jari
I have to do a similar job in the package I am working.
I think the function PP can help you to find something better.

In[4]:=PP[w_, x_] := Module[{q = w, s = Sort[x], p, h},
p = {q};
h[z_] := If[First[z] == Last[q], q = z; AppendTo[p, z], Sequence @@ {}];
h /@ s]

In[2]:=T = {{1, 2}, {3, 4}, {2, 3}, {5, 6}, {4, 5}, {6, 4}, {4, 1}};

In[5]:=PP[{1, 2}, T]
Out[5]={{{1, 2}, {2, 3}}, {{1, 2}, {2, 3}, {3, 4}}, {{1, 2}, {2, 3}, {3, 4},
{4, 1}}}

In[6]:=PP[{4, 5}, T]
Out[6]={{{4, 5}, {5, 6}}, {{4, 5}, {5, 6}, {6, 4}}}

Regards
Juan

_________________________________________________________________
Con MSN Hotmail súmese al servicio de correo electrónico más grande del
mundo. http://www.hotmail.com/ES

```

• Prev by Date: Re: How to read in the output of another nb file?
• Next by Date: batch mode and front end
• Previous by thread: Re: How to read in the output of another nb file?
• Next by thread: batch mode and front end