SequenceSplit
SequenceSplit[list,patt]
splits list into sublists separated by sequences that match the sequence pattern patt.
SequenceSplit[list,pattrhs]
inserts rhs at the position of each matched sequence.
SequenceSplit[list,{patt1rhs1,…}]
inserts rhsi at the position of each patti.
SequenceSplit[list,patt,n]
splits into at most n sublists.
Details
- SequenceSplit[list,patt] by default gives the list of sublists of list that occur between sequences defined by patt; it does not include the sequences themselves.
- SequenceSplit[list,{patt1rhs1,…,patta,…}] includes rhsi at the position of sequences matching patt1 but omits sequences matching patta.
Examples
open allclose allBasic Examples (3)
Scope (6)
Properties & Relations (8)
Insert a list of elements at the position of the matched sequence:
Use Sequence instead of List to splice the elements in the output list:
Rules are tried in the given order:
A list of sublists is considered as a single sequence pattern:
Use Alternatives to split at any of the sequence subpatterns:
The third argument of SequenceSplit is the count of sublists not considering insertions:
Split a list into sublists delimited by sequences that match a pattern:
Replace a sequence by an expression:
Find the position of the sequence:
Split at any sequence of integers:
Use SequenceCases instead:
For lists of characters, SequenceSplit is similar to StringSplit:
Compare with SplitBy:
Text
Wolfram Research (2018), SequenceSplit, Wolfram Language function, https://reference.wolfram.com/language/ref/SequenceSplit.html.
CMS
Wolfram Language. 2018. "SequenceSplit." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequenceSplit.html.
APA
Wolfram Language. (2018). SequenceSplit. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequenceSplit.html