Next: Examples Up: Core Units Previous: Examples

## Invoking Units

A unit is invoked using the `invoke-unit` form: ``

      (invoke-unit expr variable   )

The value of expr must be a unit. For each of the unit's imported variables, the `invoke-unit` expression must contain an variable. The binding for each variable in the context of the `invoke-unit` expression will be imported into the unit. More detailed information about linking is provided in the following section on compound units.

Invocation proceeds in two stages. First, invocation creates bindings for the unit's private and exported variables, and then links the unit's imported variables to bindings. All bindings are initialized to the undefined value. Second, invocation evaluates the unit's private definitions and expressions. The result of the last expression in the unit is the result of the `invoke-unit` expression. The unit's exported variable bindings are not accessible after the invocation.