assigns rhs to be the delayed value of lhs. rhs is maintained in an unevaluated form. When lhs appears, it is replaced by rhs, evaluated afresh each time.
- SetDelayed has attribute HoldAll, rather than HoldFirst.
- You can make assignments of the form lhs:=rhs/;test, where test gives conditions for the applicability of each transformation rule. You can make several assignments with the same lhs but different forms of test.
- lhs:=rhs returns Null if the assignment specified can be performed, and returns $Failed otherwise.
Examplesopen allclose all
Basic Examples (1)
Left Hand Sides (4)
A variable defined with SetDelayed is evaluated every time it is used:
Properties & Relations (9)
Definition prints definitions associated with a symbol:
Information prints various information about a symbol, including any definitions:
DownValues returns a list of rules corresponding to any downvalues defined:
Use Unset (=.) to clear definitions with a particular left-hand side:
Use ClearAll to clear attributes, too:
Possible Issues (4)
Use Evaluate to force evaluation of the right-hand side:
Or use Set to force evaluation of the right-hand side:
Wolfram Research (1988), SetDelayed, Wolfram Language function, https://reference.wolfram.com/language/ref/SetDelayed.html.
Wolfram Language. 1988. "SetDelayed." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SetDelayed.html.
Wolfram Language. (1988). SetDelayed. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetDelayed.html