Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Test whether a list contains a subsequence without requiring the subsequence to be in a single sequence
The numbers 1, 4 and 2 occur in this order in the sequence 1, 2, 3, 4, 3, 2, 1:
| In[1]:= |
| Out[1]= |
The numbers 2, 1, 2 appear in the same sequence but not in this order:
| In[2]:= |
| Out[2]= |
Check a list of digits for a range of sequential integers:
| In[3]:= |
| Out[3]= |
| In[4]:= |
| Out[4]= |
Strings are automatically converted to lists of characters:
| In[5]:= |
| Out[5]= |
ContainsOrderedItemsQ is different from SequenceCount and related functions because it allows the subsequence to be interrupted:
| In[6]:= |
| Out[6]= |
| In[7]:= |
| Out[7]= |
SequenceCount, on the other hand, requires the sequence to be together:
| In[8]:= |
| Out[8]= |
| In[9]:= |
| Out[9]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License