DownValues

DownValues[symbol] gives the list of downvalues associated with symbol.

DownValues uses HoldPattern and RuleDelayed to protect the downvalues from being evaluated. Moreover, it has attribute HoldAll to get the specified symbol instead of its value.

Mathics will sort the rules you assign to a symbol according to their specifity. If it cannot decide which rule is more special, the newer one will get higher precedence.

The default order of patterns can be computed using Sort with PatternsOrderedQ:

By assigning values to DownValues, you can override the default ordering:

Fibonacci numbers: