previous up next     contents index
Next: Invoking Units Up: Creating Compound Units Previous: Creating Compound Units

Examples

These examples use the definitions from the earlier unit examples in section 2.16.1.

This compound-unit expression below creates a useless wrapping around the unit bound to f1@:

  (define f3@
    (compound-unit
      (import)
      (link [A (f1@)])
      (export)))

The next expression links appointment-checker@ with user-interface@ and datebook-database@ (the latter has not been defined here) to build a complete appointment reminder:

  (define appointment-reminder@
    (compound-unit
      (import)
      (link [UI (user-interface@)]
            [DB (datebook-database@)]
            [CHECKER (appointment-checker@ 
                      (DB check-datebook)
                      (DB appointment-description)
                      (UI notify-user-by-simple-display))])
      (export (CHECKER last-check-date))))
The two (DB ...) sub-clauses can be collapsed to produce this equivalent expression:
  (define appointment-reminder@
    (compound-unit
      (import)
      (link [UI (user-interface@)]
            [DB (datebook-database@)]
            [CHECKER (appointment-checker@ 
                      (DB check-datebook appointment-description)
                      (UI notify-user-by-simple-display))])
      (export (CHECKER last-check-date))))



PLT