$Pre

$Pre

is a global variable whose value, if set, is applied to every input expression.

Details

  • Unless $Pre is assigned to be a function which holds its arguments unevaluated, input expressions will be evaluated before $Pre is applied, so the effect of $Pre will be the same as $Post.
  • $Pre is applied to expressions, while $PreRead is applied to strings which have not yet been parsed into expressions.

Examples

Basic Examples  (2)

By default, $Pre is not defined, meaning the input is evaluated directly:

Save input expressions in held form:

Evaluation works as expected:

Restore $Pre to its default:

The variable inputs holds the inputs in unevaluated form:

Introduced in 1988
 (1.0)