Join

Join[list1,list2,]

concatenates lists or other expressions that share the same head.

Join[list1,list2,,n]

joins the objects at level n in each of the listi.

Details

  • The listi do not need to have head List, but must all have the same head.
  • Join works on Association objects, keeping the last value associated with any given key.
  • Join works on SparseArray objects by effectively concatenating the corresponding ordinary lists. »
  • Join[list1,list2,,n] handles ragged arrays by effectively concatenating all successive elements at level n in each of the listi. »

Examples

open allclose all

Basic Examples  (3)

Infix syntax:

Join two associations:

Scope  (4)

Join two matrices to make longer columns:

Join columns of two matrices to make longer rows:

With ragged arrays, successive elements are effectively concatenated:

The second row comes from the concatenation of nothing with {3,4}:

Join depth 3 arrays at different levels:

Generalizations & Extensions  (2)

Join expressions with any head:

Join works with SparseArray objects:

Applications  (2)

Augment a matrix by adding a row:

Augment by a column:

Make a block matrix:

This can also be done with ArrayFlatten:

Properties & Relations  (1)

Join[list1,list2,] is equivalent to Flatten[{list1,list2,},1]:

Neat Examples  (2)

Successively double a list by joining to itself:

Build up the ThueMorse sequence [more info]:

Wolfram Research (1988), Join, Wolfram Language function, https://reference.wolfram.com/language/ref/Join.html (updated 2014).

Text

Wolfram Research (1988), Join, Wolfram Language function, https://reference.wolfram.com/language/ref/Join.html (updated 2014).

CMS

Wolfram Language. 1988. "Join." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Join.html.

APA

Wolfram Language. (1988). Join. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Join.html

BibTeX

@misc{reference.wolfram_2024_join, author="Wolfram Research", title="{Join}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Join.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_join, organization={Wolfram Research}, title={Join}, year={2014}, url={https://reference.wolfram.com/language/ref/Join.html}, note=[Accessed: 21-November-2024 ]}