MathGroup Archive 1997

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

Search the Archive

Re: pattern matching

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7014] Re: pattern matching
  • From: Dick Zacher <dick at loc3.tandem.com>
  • Date: Thu, 1 May 1997 14:48:58 -0400 (EDT)
  • Organization: Tandem Computers
  • Sender: owner-wri-mathgroup at wolfram.com

Marc Mazzariol 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}
> 
> I was hopping :     Out : Hello
> 

Marc,

I ran into the same problem myself 5 years ago with version 2.0.4.  It
appeared to be a defect in the software: The function RepeatedNull did
not work correctly -- it failed to match the absence of any element.  I
reported the problem to WRI at the time, but perhaps it did not get
fixed in the next 2 releases.

In Version 3.0 RepeatedNull does work and gives the results you were
expecting. (I just tested it!)

Dick

-- 
-----------------------------
Dick Zacher                    
Performance Engineering Dept., Tandem Computers
zacher_dick at tandem.com     phone: 408-285-5746     fax:   408-285-7079


  • Prev by Date: Re: pattern matching
  • Next by Date: Re: Unknown options in Mma 3.0: built-in functions vs. user-defined functions
  • Previous by thread: Re: pattern matching
  • Next by thread: Re: pattern matching