Defer

Defer[expr]

yields an object that displays as the unevaluated form of expr, but that is evaluated if it is explicitly given as Wolfram Language input.

Details

  • Defer[expr] returns an object that remains unchanged until it is explicitly supplied as Wolfram Language input and evaluated using TemplateBox[{shift, return}, Key1, BaseStyle -> {Notes, FontWeight -> Plain, FontFamily -> Source Sans Pro}], Evaluate in Place, etc.
  • Defer gives an object whose evaluation is merely deferred until it is explicitly given as Wolfram Language input; HoldForm gives an object that is never evaluated.
  • If an object contains several levels of nested Defer constructs, one level is removed each time the object is evaluated as Wolfram Language input.
  • Defer prevents evaluation, not formatting. Objects such as Grid and Manipulate will still format in StandardForm in the usual way when wrapped in Defer.

Examples

open allclose all

Basic Examples  (2)

By default, arguments are evaluated:

Use Defer to display an unevaluated form:

Copy the previous output and evaluate:

Use Defer to create cells with unevaluated contents:

Properties & Relations  (1)

Use HoldForm to display in unevaluated form:

Copy the output and evaluate; the result stays unevaluated:

Use ReleaseHold to force evaluation of the result:

Use Defer to display in unevaluated form:

Copy the output and evaluate:

Possible Issues  (1)

Defer prevents evaluation, not typesetting:

Use InputForm or ToString to prevent typesetting:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_defer, author="Wolfram Research", title="{Defer}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Defer.html}", note=[Accessed: 17-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_defer, organization={Wolfram Research}, title={Defer}, year={2007}, url={https://reference.wolfram.com/language/ref/Defer.html}, note=[Accessed: 17-December-2024 ]}