Split
Usage
Notes
Further Examples
Here is a list.
In[1]:=
|
This splits mm into sublists consisting of runs of identical elements.
In[2]:=
|
Out[2]=
|
This treats two adjacent elements as identical whenever they are congruent modulo .
In[3]:=
|
Out[3]=
|
Here is another list.
In[4]:=
|
This sorts and partitions nn into sublists that are in the half-open intervals , , and so on.
In[5]:=
|
Out[5]=
|
This defines the function RunLengthEncode which gives a list of pairs. The pair {x, y} corresponds to a run of the element x of length y.
In[6]:=
|
In[7]:=
|
Out[7]=
|
This defines the function Classify which partitions the list s into a list of disjoint sublists such that the function f evaluates to a different constant on each sublist. In other words Classify returns the preimages of s under f.
In[8]:=
|
The default for f is the identity function.
In[9]:=
|
Out[9]=
|
Here is a nested list.
In[10]:=
|
This groups the elements of pp whose first and third elements are identical.
In[11]:=
|
In[12]:=
|
Out[12]=
|
In[13]:=
|
|