Applying Functions to Lists

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

ReferenceReference

Map (/@) map a function over a list, at specified levels

Apply (@@, @@@) — apply a function to a list, at specified levels

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

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

New to Mathematica? Find your learning path »
Have a question? Ask support »