MathGroup Archive 1997

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

Search the Archive

Re: pattern matching

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6992] Re: pattern matching
  • From: gaylord at ux1.cso.uiuc.edu (richard j. gaylord)
  • Date: Thu, 1 May 1997 14:48:39 -0400 (EDT)
  • Organization: university of illinois
  • Sender: owner-wri-mathgroup at wolfram.com

In article <5k683j$gh6 at smc.vnet.net>, Marc Mazzariol
<Marc.Mazzariol at di.epfl.ch> wrote:

> Hello,
> 
> I'm using mathematica 2.2 (Unix), and i'm trying to do pattern 
> matching with repeated patterns.
> 
> This example produce the result i want :
> 
>         In :  {a,a,a,b} /. {a...,b} -> Hello
>         Out : Hello
> 
> But this one don't :
>         
>         In : {b} /. {a...,b} -> Hello
>         Out : {b}
> 
running 3.0 on a power mac works fine

In[9]:=
 {a,a,a,b} /. {a...,b} -> Hello

Out[9]=
Hello

In[10]:=
 {b} /. {a...,b} -> Hello

Out[10]=
Hello

note: also this works

In[7]:=
 {a,a,a,b} /. {___,b} -> Hello

Out[7]=
Hello

In[8]:=
{b} /. {___,b} -> Hello

Out[8]=
Hello

-- 
richard j. gaylord, university of illinois, gaylord at uiuc.edu

"What I cannot create, I do not understand"
           -Richard P. Feynman-


  • Prev by Date: Re: [Q] Prblems with characters
  • Next by Date: Re: pattern matching
  • Previous by thread: pattern matching
  • Next by thread: Re: pattern matching