({{, (RefLink[Thread, paclet:ref/Thread])[f[args]] 
"threads" f over any lists that appear in args. }, {, (RefLink[Thread, paclet:ref/Thread])[f[args],h] 
threads f over any objects with head h that appear in args. }, {, (RefLink[Thread, paclet:ref/Thread])[f[args],h,n] 
threads f over objects with head h that appear in the first n args. }})

OpenersNotesSection(Spacer1)Details

Functions with attribute (RefLink[Listable, paclet:ref/Listable]) are automatically threaded over lists.

All the elements in the specified args whose heads are h must be of the same length.

Arguments that do not have head h are copied as many times as there are elements in the arguments that do have head h. »

(RefLink[Thread, paclet:ref/Thread]) specifies arguments using the standard sequence specification:

OpenersPrimaryExamplesSection(Spacer1)Examples  (20)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Thread[f[{a,b,c}]]

Thread[f[{a,b,c},x]]

Thread[f[{a,b,c},{x,y,z}]]

Convert equations for lists to lists of equations:

Thread[{a,b,c}=={x,y,z}]

Apply a function to both sides of an equation:

Thread[Log[x==y],Equal]

OpenersExampleSection1(Spacer1)Scope  (9)

OpenersExampleSubsection0(Spacer1)Sequence Specifications  (7)

By default, thread over all arguments:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List]

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,All]

Do not thread at all:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,None]

Thread over the first two arguments only:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,2]

Thread over the last two arguments only:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,-2]

Thread over argument 2 only:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,{2}]

Thread over arguments 2 through 4:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,{2,4}]

Thread over every other argument:

Thread[f[{a,b},{r,s},{u,v},{x,y}],List,{1,-1,2}]

OpenersExampleSubsection1(Spacer1)Head Specification  (2)

By default, thread over lists:

Thread[f[{a,b},{c,d}]]

Thread[f[{a,b},{c,d}],List]

By default, does not thread over heads other than (RefLink[List, paclet:ref/List]):

Thread[f[a+b,c+d]]

Thread with respect to (RefLink[Plus, paclet:ref/Plus]):

Thread[f[a+b,c+d],Plus]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

Elements that are not lists are repeated:

Thread[f[{a,b,c},h,{x,y,z}]]

{1,2,3}^2

OpenersExampleSection3(Spacer1)Applications  (3)

Build a list of rules:

Thread[{a,b,c}->{1,2,3}]

Equate coefficients in a polynomial equation:

CoefficientList[#,x]&/@(1+2x+3x^2==a+b x + c x^2)

Thread[%]

Alternatively, use (RefLink[SolveAlways, paclet:ref/SolveAlways]):

SolveAlways[1+2x+3x^2==a+b x + c x^2,x]

Form pairs with a constant second element:

Thread[{{a,b,c},0}]

OpenersExampleSection4(Spacer1)Properties & Relations  (3)

Functions with attribute (RefLink[Listable, paclet:ref/Listable]) are threaded automatically over lists:

Sqrt[{1,2,3,4}]

{1,2,3,4}+1

{1,2,3,4}+{a,b,c,d}

(RefLink[MapThread, paclet:ref/MapThread]) works like (RefLink[Thread, paclet:ref/Thread]), but takes the function and arguments separately:

MapThread[f,{{a,b,c},{x,y,z}}]

Thread[f[{a,b,c},{x,y,z}]]

The function to thread over can be (RefLink[List, paclet:ref/List]) as well:

Thread[{{a,b,c},{x,y,z}}]

In this case, the result is the same as a transposition:

Transpose[{{a,b,c},{x,y,z}}]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

(RefLink[Thread, paclet:ref/Thread]) evaluates the whole expression before threading:

Thread[D[{x,x y, x z},{x,y,z}]]

(RefLink[MapThread, paclet:ref/MapThread]) takes the function and its arguments separately:

MapThread[D,{{x,x y,x z},{x,y,z}}]

Suppressing evaluation has a similar effect:

Thread[Unevaluated[D[{x,x y, x z},{x,y,z}]]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Distribute, paclet:ref/Distribute])  ▪  (RefLink[Map, paclet:ref/Map])  ▪  (RefLink[Inner, paclet:ref/Inner])  ▪  (RefLink[MapThread, paclet:ref/MapThread])  ▪  (RefLink[AssociationThread, paclet:ref/AssociationThread])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Structural Operations, paclet:tutorial/StructuralOperations])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Applying Functions to Lists, paclet:guide/ApplyingFunctionsToLists])}, {▪(RefLinkPlain[Manipulating Equations, paclet:guide/ManipulatingEquations])}, {▪(RefLinkPlain[Structural Operations on Expressions, paclet:guide/StructuralOperationsOnExpressions])}, {▪(RefLinkPlain[Expressions, paclet:guide/Expressions])}, {▪(RefLinkPlain[List Manipulation, paclet:guide/ListManipulation])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/30-rearranging-lists.html])(WebLink[: Rearranging Lists, https://www.wolfram.com/language/elementary-introduction/30-rearranging-lists.html])}})}})