Definition

Definition[symbol]

prints as the definitions given for a symbol.

Definition[patt]

prints as the definitions given for the symbols whose names textually match the arbitrary string pattern patt.

Definition[{spec1,spec2,}]

prints as the definitions given for the symbols that are equal to or or whose names match any of the speci.

Details

  • Definition[symbol] prints as all values, attributes, defaults and options for symbol. »
  • The pattern patt can be given as a string with metacharacters, as StringExpression[] or as RegularExpression["regex"]. »
  • Definition allows abbreviated string patterns containing the following metacharacters:
  • *zero or more characters
    @one or more characters, excluding uppercase letters
  • Definition["context`*"] prints as the definitions for all symbols in a particular context. »
  • Definition["`*"] prints as the definitions for all symbols in the current context. »
  • Definition does not show rules associated with symbols that have attribute ReadProtected. »
  • Definition has attribute HoldAll. »

Examples

open allclose all

Basic Examples  (2)

Get the attributes, defaults and options for a built-in symbol:

Get the definitions for user-defined symbols:

Scope  (9)

Symbol Inputs  (4)

For built-in symbols, Definition gives attributes, defaults and options:

For user-defined symbols, Definition gives attributes, defaults, options and definitions:

Print the definitions of several symbols:

Use a combination of symbols and symbol names:

Using Patterns  (5)

Specify symbols as string patterns:

Get the definitions for all symbols in the current context:

Get the definitions for all symbols in a given context:

Get the definitions for all 2-character symbols in the current context using StringExpression:

Get the definitions for all 3-character symbols in the current context using RegularExpression:

Properties & Relations  (6)

For read-protected symbols, definitions are not given:

Definition gives attributes, defaults, options and values:

Defintion[pattern] gives definitions for the symbols returned by Names[pattern]:

Definition does not give messages:

FullDefinition does give messages:

Use Messages to get the messages:

Information returns the values rendered by Definition, as well as usage messages:

?? is the same as Information:

Definition has the attribute HoldAll:

This gives the definition of symbol itself:

This gives the definition of its value:

Possible Issues  (3)

Definition is an output form; it does not evaluate:

Definition["symbol"] gives no values if there is no symbol named "symbol":

Definition["symbol"] also gives no values if symbol has no values:

When using a pattern without a context mark, all definitions for matching symbols on $ContextPath are given:

Use a pattern with an explicit context mark to avoid potentially matching symbols from system or other contexts:

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

Text

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

CMS

Wolfram Language. 1988. "Definition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Definition.html.

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_definition, organization={Wolfram Research}, title={Definition}, year={2022}, url={https://reference.wolfram.com/language/ref/Definition.html}, note=[Accessed: 18-November-2024 ]}