gives a list of the starting and ending positions at which sublist appears in list.
gives all positions at which sequences matching patt occur in list.
includes only the first n occurrences of patt.
Details and Options
- In SequencePosition[list,patt], patt can be an expression with head List that includes pattern constructs such as PatternSequence, Repeated (..), Blank (_), and BlankSequence (__).
- The pattern patt can also be a pattern that matches a list but does not itself have head List.
- With the default option setting Overlaps->True, SequencePosition includes sublists that overlap. With the setting Overlaps->False, such sublists are excluded.
- With Overlaps->All, multiple sublists that match the same pattern are all included. With Overlaps->True, only the first such matching sublist at a given position is included.
Examplesopen allclose all
Basic Examples (2)
Properties & Relations (3)
SubsetPosition matches the elements of the sequence in any order:
SequencePosition matches the sequence only in the specified order:
Wolfram Research (2015), SequencePosition, Wolfram Language function, https://reference.wolfram.com/language/ref/SequencePosition.html.
Wolfram Language. 2015. "SequencePosition." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequencePosition.html.
Wolfram Language. (2015). SequencePosition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequencePosition.html