(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