ListTools - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : ListTools Package : ListTools/Collect

ListTools

 Collect
 interspace the elements of a list with an object

 Calling Sequence Collect( L )

Parameters

 L - list

Description

 • The Collect( L ) function produces a list of pairs [ expr, f ] from the input list L, for which expr is an expression occurring in L and f is the (positive) integral number of occurrences of expr in L.
 • Note that the order of the output is session dependent, and is therefore not defined.

Examples

 > $\mathrm{with}\left(\mathrm{ListTools}\right):$
 > $\mathrm{Collect}\left(\left[\right]\right)$
 $\left[\right]$ (1)
 > $\mathrm{Collect}\left(\left[3\right]\right)$
 $\left[\left[{3}{,}{1}\right]\right]$ (2)
 > $\mathrm{Collect}\left(\left[2,2,3,2,4,2,3,5,4\right]\right)$
 $\left[\left[{2}{,}{4}\right]{,}\left[{3}{,}{2}\right]{,}\left[{4}{,}{2}\right]{,}\left[{5}{,}{1}\right]\right]$ (3)

Compatibility

 • The ListTools[Collect] command was introduced in Maple 2017.