I have a list of integers:
s = {4, 5, 5, 6, 2, 5, 3, 2, 4, 2, 1, 1, 4, 3, 4, 3, 1, 6, 3, 4};
And if I do this, both occurrences of 4 after 3 are replaced.
s //. {x___, PatternSequence[3, 4], y___} :> {x, Null, y}
But doing the two thing below with Cases gives an empty list. What's the correct way to do it? And, what if I want to find only that Seqence[3, 4] that follows something less than 6; how should I insert /;?
Cases[s, {___, PatternSequence[3, 4], ___}]
Cases[s, PatternSequence[3, 4]]
Update: This is much closer to my actual problem.
Starting with a list of unique integer points.
p1 = With[{a = 20},
Table[Round[a {Cos[t], Sin[t]}],
{t, 0, 2 Pi, 2 Pi/1000}]] // DeleteDuplicates;
With the help of Mr.Wizard and Spawn1701D I can already find the corner points (redundant for my case), and then take Complement to original p1. Can this dropping be done directly with DeleteCases let's say? (I can see the corner points aren't defined uniquely, which doesn't matter now.)
p2 = ReplaceList[p1, {___, ps : PatternSequence[
{_, y1_}, {x2_, y2_}, {x3_, _}] /; y2 == y1 && x2 == x3,
___} :> {ps}] // Map[#[[2]] &, #] &;
GraphicsRow[Graphics[{PointSize[.015],
Point@#}] & /@ {p1, p1~Complement~p2}]

Caseyou have to put{s}if you look at the online manual the entry forCasesyou will notice thatCaselook inside a list for the pattern (or inside the arguments of a function H) and inside your list there isn't the pattern you are looking for. For your last question just usePatternSequence[a_,3,4]/;a<6. $\endgroup$