Applying Functions to Lists

Many computations are conveniently specified in terms of applying functions in parallel to many elements in a list. The Wolfram Language provides a suite of elegant functional programming constructs for doing this. In the Wolfram Language, mathematical functions are automatically taken to be "listable", so that they are always applied to every element in a list.

Map ( /@ ) — map a function over a list, at specified levels Apply ( @@ ) — apply a function to a list, at specified levels MapApply ( @@@ ) — apply a function to the elements of a list MapIndexed — map a function, including index information MapAt — map a function at particular positions Scan — scan over every element of a list, applying a function

Multi-Element Mapping

BlockMap — map a function onto blocks of elements in a list SubsetMap — apply a function "in place" to subsets of elements ArrayFilter — apply a function to neighborhoods in an array

Array Reduction

ArrayReduce — reduce an array by applying a function along a certain dimension

FoldList — successively apply a function, "folding in" elements from a list ComposeList ▪ Outer ▪ Inner ▪ Accumulate ▪ Differences ▪ Ratios MapThread — map a function across corresponding elements in multiple lists

Thread — "thread" a function across lists that appear in its arguments Listable — attribute for any function to automatically thread over lists

Dataset — set up a nested list to be manipulated as a structured dataset

Related Tech Notes

Related Guides