Rearranging & Restructuring Lists

The Wolfram Language encapsulates in a small number of functions vast flexibility in rearranging lists with any structure and any number of elements.

(RefLink[Flatten, paclet:ref/Flatten]) — flatten out any sequence of levels in a nested list

(RefLink[Partition, paclet:ref/Partition]) — partition lists or nested lists into sublists

(RefLink[Join, paclet:ref/Join]) — join lists together at any level

(RefLink[Catenate, paclet:ref/Catenate]) — catenate elements from a list of lists

(RefLink[TakeList, paclet:ref/TakeList]) — take a succession of sublists from a list

(RefLink[Sort, paclet:ref/Sort]) — sort lexicographically or with any comparison function

(RefLink[ReverseSort, paclet:ref/ReverseSort]) — sort reverse lexicographically

(RefLink[SortBy, paclet:ref/SortBy]) — sort by the values of a function applied to elements

(RefLink[Reverse, paclet:ref/Reverse]) — reverse a list at any level

(RefLink[RotateLeft, paclet:ref/RotateLeft]), (RefLink[RotateRight, paclet:ref/RotateRight]) — cyclically rotate lists at any depth

(RefLink[Transpose, paclet:ref/Transpose]) — transpose any collection of levels

(RefLink[ArrayResample, paclet:ref/ArrayResample]) — resample an array to higher or lower resolution

(RefLink[ArrayPad, paclet:ref/ArrayPad]) — add padding on each side

(RefLink[ArrayFilter, paclet:ref/ArrayFilter]) — filter an array using local neighborhoods

(RefLink[Riffle, paclet:ref/Riffle]) — intersperse additional elements

(RefLink[PadLeft, paclet:ref/PadLeft]), (RefLink[PadRight, paclet:ref/PadRight]) — pad lists to be a particular length at any depth

(RefLink[Split, paclet:ref/Split]) — split into runs of identical elements

(RefLink[Gather, paclet:ref/Gather]) — gather sublists of identical elements

(RefLink[Union, paclet:ref/Union]), (RefLink[Tally, paclet:ref/Tally]) — enumerate, tally all distinct elements in a list

(RefLink[DeleteDuplicates, paclet:ref/DeleteDuplicates]) — delete duplicate elements in a list

(RefLink[DeleteDuplicatesBy, paclet:ref/DeleteDuplicatesBy]) — delete elements for which values of a function are duplicated

(RefLink[SplitBy, paclet:ref/SplitBy]), (RefLink[GatherBy, paclet:ref/GatherBy]) — split, gather based on values of a function applied to elements

(RefLink[Groupings, paclet:ref/Groupings]) — generate all possible groupings of a list into sublists

Sequence-Oriented Operations

(RefLink[SequenceSplit, paclet:ref/SequenceSplit]) — split a list at sequences matching a pattern

(RefLink[SequenceReplace, paclet:ref/SequenceReplace]) — replace sequences in a list

(OrangeLink[Element-Oriented Operations », paclet:guide/ElementsOfLists])