UpSetDelayed

lhs^:=rhs

assigns rhs to be the delayed value of lhs, and associates the assignment with symbols that occur at level one in lhs.

Examples

open allclose all

Basic Examples  (1)

Scope  (6)

Left-Hand Sides  (5)

An expression with a delayed definition is evaluated every time it is used:

Make definitions for special and general cases using immediate and delayed assignments:

The definition can be associated with a symbol appearing as an argument of the left side:

The definition can be associated with the head of an argument of the left side:

If several symbols appear in the left-hand side, upvalues for all of them are defined:

Different Kinds of Values  (1)

^:= defines upvalues:

Properties & Relations  (6)

^:= defines upvalues in the same way as using a tag does:

A tag defines only one upvalue; ^:= makes definitions for all symbols:

The right side of an immediate definition is evaluated when the definition is made:

The right side of a delayed definition is evaluated each time the definition is used:

Definitions with the same left side overwrite earlier ones:

Definition prints definitions associated with a symbol:

Information prints various information about a symbol, including any definitions:

UpValues returns a list of rules corresponding to any upvalues defined:

Delayed assignment introduces a scope that is not affected by global variables:

Immediate assignment does not introduce a scope:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_upsetdelayed, organization={Wolfram Research}, title={UpSetDelayed}, year={1988}, url={https://reference.wolfram.com/language/ref/UpSetDelayed.html}, note=[Accessed: 12-November-2024 ]}