UpValues

UpValues[f]

gives a list of transformation rules corresponding to all upvalues defined for the symbol f.

Details and Options

  • You can specify the upvalues for f by making an assignment of the form UpValues[f]=list.
  • The list returned by UpValues has elements of the form HoldPattern[lhs]:>rhs.

Examples

open allclose all

Basic Examples  (1)

Define upvalues for a symbol g:

These are the upvalues associated with g:

Scope  (2)

UpValues returns rules corresponding to upvalues defined for a symbol:

UpValues can be used to set the values directly:

Applications  (1)

Copy a symbol's definitions to another symbol:

Properties & Relations  (3)

HoldPattern is used to protect the rules from their own definitions:

Definition and Information display upvalues but do not return them as values:

UpValues returns a value that can be used in a program:

Evaluation of an expression involves applying matching upvalues:

Introduced in 1991
 (2.0)
 |
Updated in 1996
 (3.0)