Previous Section Next Section

$:

Specify a default database-map value RHS database operator

When looking up information with the $( and $) operators it is sometimes desirable to provide a default return value, should the lookup fail. Default values are specified with the $: operator, which fits between the $( and $) operators like this:

LHS....      $( name key $:  default  $)

Here, name is the symbolic name you associated with a dbtype (Section 23.2.2) using the K configuration command. The key is the value being looked up, and default is the value to be placed in the workspace if the lookup fails.

To illustrate, consider the following rule:

R $+ < @ $* . fax >        $: $1 < @ $(faxdb $2 $: faxhost $) >

Here, any address that ends in .fax (such as bob@here.fax) has the host part ($* or the here) looked up in the faxdb database (the $2 is the key). If that host is not found with the lookup, the workspace is changed to user<@faxhost> (or, for our example, bob@faxhost).

See Section 23.4.1 for a complete description of the $: operator as it is used with database maps.

    Previous Section Next Section