AssociateTo

AssociateTo[a,keyval]

changes the association a by adding the key-value pair keyval.

AssociateTo[a,{key1val1,key2val2,}]

adds all key-value pairs keyivali.

Details

  • AssociateTo has attribute HoldFirst.
  • AssociateTo effectively modifies the value of a in place.

Examples

Basic Examples  (3)

Create an association:

Change the value associated with a:

If a key is not already in the association, it is added to it:

Change several values in an association:

Append one association to another:

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

Text

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

CMS

Wolfram Language. 2014. "AssociateTo." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AssociateTo.html.

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2023_associateto, organization={Wolfram Research}, title={AssociateTo}, year={2014}, url={https://reference.wolfram.com/language/ref/AssociateTo.html}, note=[Accessed: 19-March-2024 ]}