Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

(x...) only works when x == _

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg433] (x...) only works when x == _
  • From: perkins at colorado.edu (Tyler Perkins)
  • Date: Fri, 27 Jan 1995 15:54:07 -0700

Here is some odd fundamental behavior that appears to be a bug.

According to the Book, the form "RepeatedNull[x]" should match zero or more
occurances of "x", whether or not x is a pattern object.  Nope!

  MatchQ[{},{x...}]
  False

Yet it works when is x is the pattern "_":

  MatchQ[{}, {_...}]
  True

OK, so let's change "x" into a pattern object:

  MatchQ[{},{(s1:x)...}]
  False

Hmmm.  That didn't work either.  The only way I've found to get what I want
is to use the pattern "((s1:_) /; s1 == x)" instead of just "x":

  MatchQ[{},{((s1:_) /; s1 == x)...}]
  True

So why doesn't MatchQ[{},{x...}] ?

        Tyler Perkins                   perkins at colorado.edu




  • Prev by Date: MultipleLogListPlot
  • Next by Date: goto-do-label
  • Previous by thread: MultipleLogListPlot
  • Next by thread: goto-do-label