MathGroup Archive 1997

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

Search the Archive

Re: Nesting in patterns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8592] Re: [mg8565] Nesting in patterns
  • From: David Withoff <withoff>
  • Date: Sun, 7 Sep 1997 22:13:11 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

> Can I have nested blanks in patterns?  Specifically,
> I would like to be able to do something like
>
> MatchQ[{{1,2},{1,2}}, {x__}__]     
> 
> with the x matching the sequence 1,2 .  This doesn't work,
> but is there something similar that I can do?
> 
> Will Self 
> Montana State University Billings
> "The University of the Yellowstone Valley"

Will a pattern like this do what you want?

In[1]:= MatchQ[{{1,2},{1,2}}, {{x__}..}]

Out[1]= True

The expression {x__}__ evaluates to {__ x__}, a list containing
the product of __ and x__, which is probably not what you wanted.
   
Dave Withoff
Wolfram Research


  • Prev by Date: Re: Packages again
  • Next by Date: RE: Combining Lists?
  • Previous by thread: Nesting in patterns
  • Next by thread: William Shaw News Release