Verbatim

Verbatim[expr]

represents expr in pattern matching, requiring that expr be matched exactly as it appears, with no substitutions for blanks or other transformations.

Details

  • Verbatim[x_] will match only the actual expression x_.
  • Verbatim is useful in setting up rules for transforming other transformation rules.
  • Verbatim[expr] does not maintain expr in an unevaluated form.

Examples

open allclose all

Basic Examples  (2)

Match any expression:

Match only the pattern x_:

Changes the pattern only when it is explicitly f[x_]:

Scope  (1)

Transform a rule into a list of rules with special cases:

This rule transforms an expression into its square:

Use Verbatim to make rules specific for number types:

The list of specific rules only transforms integers, reals, and rationals:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

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