Flat
Usage
Notes
Further Examples
This clears all of the rules and attributes for a symbol fff.
In[1]:=
|
This gives fff the attribute Flat.
In[2]:=
|
Inputs with a head of fff will now be flattened automatically over fff.
In[3]:=
|
Out[3]=
|
The Flat attribute also has an effect in pattern matching. This rule applies because of the Flat attribute.
In[4]:=
|
Out[4]=
|
This removes the Flat attribute from fff.
In[5]:=
|
Without the Flat attribute, this rule is not used.
In[6]:=
|
Out[6]=
|
Associative operations, such as Plus, have the Flat attribute.
In[7]:=
|
Out[7]=
|
This rule is applied because of the Flat attribute of Plus.
In[8]:=
|
Out[8]=
|
This also works.
In[9]:=
|
Out[9]=
|
RunLengthEncode gives a list of pairs. The pair {x, y} corresponds to a run of length y of the element x. (See the Further Examples for Split for another implementation.)
In[10]:=
|
In[11]:=
|
In[12]:=
|
In[13]:=
|
Out[13]=
|
|