[previous] [up] [next]     [index]
Next: Tools Up: Extending DrScheme Previous: Extending DrScheme

Teachpacks

Teachpacks are designed to supplement student programs with code that is beyond the teaching languages (Beginning Student, Intermediate Student, Advanced Student). For example, to enable students to play hangman, we supply a teachpack that

All these tasks are beyond students in the third week and/or impose memorization of currently useless knowledge on students.

A single Scheme source file defines a teachpack (although the file is likely to access other files). The last expression in the file must evaluate to a signed unit (see units) that imports the plt:userspace^ signature. When a user selects the library into DrScheme, DrScheme adds the names in the unit's export signature to the user's namespace.

The plt:userspace^ signature is defined in the userspcs.ss file of the userspce collection (see Library Collections and MzLib). The signature contains only mred^ and mzlib:core-flat^. To use other libraries, the teachpack author must use a compound unit and link in other libraries.

A teachpack file is always loaded with Full Scheme (with graphics, without debugging), but in case-sensitive mode (so that a library can export case-sensitive names to the teaching languages).

As an example example, the following signed unit defines a library that adds the binding four to the user's namespace:

  (unit/sig (four)
    (import plt:userspace^)
    (define four 4))
For more interesting examples, see the htdp directory of the teachpack directory in the PLT installation.



PLT