# Building Lists from Functions

 Array[f,n] generate a length n list of the form {f,f,…} Array[f,{n1,n2,…}] generate an n1×n2×… nested list, each of whose entries consists of f applied to its indices NestList[f,x,n] generate a list of the form {x,f[x],f[f[x]],…}, where f is nested up to n deep FoldList[f,x,{a,b,…}] generate a list of the form {x,f[x,a],f[f[x,a],b],…} ComposeList[{f1,f2,…},x] generate a list of the form {x,f1[x],f2[f1[x]],…}

Making lists from functions.

This makes a list of 5 elements, each of the form p[i]:
 In:= Out= Here is another way to produce the same list:
 In:= Out= This produces a list whose elements are :
 In:= Out= This generates a 2×3 matrix whose entries are m[i,j]:
 In:= Out= This generates a 3×3 matrix whose elements are the squares of the sums of their indices:
 In:= Out= NestList and FoldList were discussed in "Applying Functions Repeatedly". Particularly by using them with pure functions, you can construct some very elegant and efficient Wolfram Language programs.

This gives a list of results obtained by successively differentiating with respect to :
 In:= Out= 