Thread
Details
- Functions with attribute 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. »
- Thread specifies arguments using the standard sequence specification:
-
All all elements None no elements n elements 1 through n -n last n elements {n} element n only {m,n} elements m through n inclusive {m,n,s} elements m through n in steps of s
Examples
open all close allBasic 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]Scope (9)
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]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[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}]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 List:
Thread[f[a + b, c + d]]Thread with respect to Plus:
Thread[f[a + b, c + d], Plus]Generalizations & Extensions (1)
Elements that are not lists are repeated:
Thread[f[{a, b, c}, h, {x, y, z}]]The repetition of non-lists also occurs in functions with attribute Listable:
{1, 2, 3} ^ 2 === {1 ^ 2, 2 ^ 2, 3 ^ 2}Attributes[Power]Applications (3)
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 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}]Properties & Relations (3)
Functions with attribute Listable are threaded automatically over lists:
Sqrt[{1, 2, 3, 4}]{1, 2, 3, 4} + 1{1, 2, 3, 4} + {a, b, c, d}MapThread works like 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 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}}]Possible Issues (1)
Thread evaluates the whole expression before threading:
Thread[D[{x, x y, x z}, {x, y, z}]]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}]]]See Also
Distribute Map Inner Threaded MapThread AssociationThread NonThreadable
Function Repository: Unthread
Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), Thread, Wolfram Language function, https://reference.wolfram.com/language/ref/Thread.html.
CMS
Wolfram Language. 1988. "Thread." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Thread.html.
APA
Wolfram Language. (1988). Thread. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Thread.html
BibTeX
@misc{reference.wolfram_2026_thread, author="Wolfram Research", title="{Thread}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Thread.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_thread, organization={Wolfram Research}, title={Thread}, year={1988}, url={https://reference.wolfram.com/language/ref/Thread.html}, note=[Accessed: 12-June-2026]}