Gather

Gather[list]

gathers the elements of list into sublists of identical elements.

Gather[list,test]

applies test to pairs of elements to determine if they should be considered identical.

Details

  • The default function used to test whether elements are identical is SameQ.
  • Gather[{e1,e2,},p] will gather together elements for which p[ei,ej] returns True.

Examples

open allclose all

Basic Examples  (2)

Gather elements into sublists of identical elements:

In[2]:=
Click for copyable input
Out[2]=

Gather elements that have identical first parts:

In[1]:=
Click for copyable input
Out[1]=

Applications  (3)

Properties & Relations  (2)

Possible Issues  (1)

See Also

GatherBy  GroupBy  Merge  Tally  BinLists  Partition  DeleteDuplicates  Split  Sort  Counts  Cases  Select

Introduced in 2008
(7.0)