Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: simultaneous ... and ___

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60867] Re: simultaneous ... and ___
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 1 Oct 2005 02:55:43 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <dhj4ll$smo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

you know that your pattern are perfect nonsense ?

m[{___, x1__ , x2___ , x3___ , ___, x3___ , x2___ 
,
      x1__ , ___}] := {} /; (Length[{x1}] + 
Length[{x1}] + Length[{x1}]) = 5
will never match, because (Length[{x1}] + 
Length[{x1}] + Length[{x1}]) is
3*Length[{x1}] and you *set* this value to 5 ?? 
you don't test 3*Length[{x1}]==5
? and even when you would test 3*Length[{x1}]==5 
this will always fail ?

If you ask a question about pattern matching, can 
you be so kind to copy and paste
*exactly* your Mathematica code ?

More over the pattern

x2___... mean that the sequence x2 may be empty 
and this "nothing" can be
repated zero or more times, even a empty list 
contain "nothing" zero more times
repeated. Than you look for the case that 
{__,x2___...,____,x2___...,___}
and that mean that "nothing" may appear a second 
time zero or more times.

You don't realy expect that Mathematica will 
understand this ? and it seems that
you also don't understand what you are writing.

Regards
  Jens

<borges2003xx at yahoo.it> schrieb im Newsbeitrag 
news:dhj4ll$smo$1 at smc.vnet.net...
|i have a function m
| Clear[m]
| m[{___, x1__ , x2___ , x3___ , ___, x3___ , 
x2___ ,
|      x1__ , ___}] := {} /; (Length[{x1}] + 
Length[{x1}] +
| Length[{x1}]) = 5
|
|
| m[l_] := l
| which transform every string in which three 
sublists are followed by
| the three in reverse order, and the total of 
length of three are >=5.
|
| Everything seems to works
|
| now i want consider the same three sublists in 
which is permitted also
| the repetition one or more times.
|
| Clear[m1]
| m1[{___, x1__ .., x2___ ..., x3___ ..., ___, 
x3___ ..., x2___ ...,
|      x1__ .., ___}] := {}
| m1[l1_] := l1
|
| and all seem to work
| m[{0, 1, 1, 2, 2, 2, 3, 4, 3, 3, 3, 3, 2, 1, 1, 
1, 1, 8}]
| gives {}
|
| but if i add the length
|
| m1[{___, x1__ .., x2___ ..., x3___ ..., ___, 
x3___ ..., x2___ ...,
|      x1__ .., ___}] := {}
| /; (Length[{x1}] + Length[{x1}] + Length[{x1}]) 
 >= 15
| m1[l1_] := l1
|
| dont work
| m[{0, 1, 1, 2, 2, 2, 3, 4, 3, 3, 3, 3, 2, 1, 1, 
1, 1, 8}]
| gives
| m[{0, 1, 1, 2, 2, 2, 3, 4, 3, 3, 3, 3, 2, 1, 1, 
1, 1, 8}]
|
| if i change 15 with 6 for length
| dont work
|
|
| can anyone help me?
| 



  • Prev by Date: Re: axes for Plot3D
  • Next by Date: Re: Solve / NSolve take too much time or fail
  • Previous by thread: Re: Re: what is wrong with this plot?
  • Next by thread: Re: simultaneous ... and ___