Functional Programming

Functional programming is a highly developed and deeply integrated core feature of the Wolfram Language, made dramatically richer and more convenient through the symbolic nature of the language. Treating expressions like f[x] as both symbolic data and the application of a function f provides a uniquely powerful way to integrate structure and function—and an efficient, elegant representation of many common computations.

(RefLink[Function, paclet:ref/Function]) ((RefLink[&, paclet:ref/Function])) — specify a pure function (e.g. (#+1)&)

(RefLink[#, paclet:ref/Slot]), (RefLink[##, paclet:ref/SlotSequence]), (RefLink[#name, paclet:ref/Slot]) — slots for variables in a pure function

(OrangeLink[Applying Functions to Lists », paclet:guide/ApplyingFunctionsToLists])

(RefLink[Map, paclet:ref/Map]) ((RefLink[/@, paclet:ref/Map])) — map across a list: f/@{x,y,z}⟶{f[x],f[y],f[z]}

(RefLink[Apply, paclet:ref/Apply]) ((RefLink[@@, paclet:ref/Apply]), (RefLink[@@@, paclet:ref/Apply])) — apply to a list: f@@{x,y,z}⟶f[x,y,z]

(RefLink[MapIndexed, paclet:ref/MapIndexed]) — map with index information: {f[x,{1}],f[y,{2}],f[z,{3}]}

(OrangeLink[Iteratively Applying Functions », paclet:guide/FunctionalIteration])

(RefLink[Nest, paclet:ref/Nest]), (RefLink[NestList, paclet:ref/NestList]), (RefLink[NestGraph, paclet:ref/NestGraph]) — nest a function: f[f[f[x]]] etc.

(RefLink[Fold, paclet:ref/Fold]), (RefLink[FoldList, paclet:ref/FoldList]) — fold in a list of values: f[f[f[x,1],2],3] etc.

(RefLink[FixedPoint, paclet:ref/FixedPoint]), (RefLink[FixedPointList, paclet:ref/FixedPointList]) — repeatedly nest until a fixed point

(OrangeLink[List-Oriented Functions », paclet:guide/RearrangingAndRestructuringLists])

(RefLink[Select, paclet:ref/Select]) — select from a list according to a function

(RefLink[Array, paclet:ref/Array]) — create an array from a function

(OrangeLink[Association-Oriented Functions, paclet:guide/Associations])

(RefLink[AssociationMap, paclet:ref/AssociationMap]) — create an association from a function

(OrangeLink[Functional Composition, paclet:guide/FunctionCompositionAndOperatorForms])

(OrangeLink["Curried" Operator Forms », paclet:guide/FunctionCompositionAndOperatorForms])