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
A single Scheme source file defines a teachpack (although the file may access other files via load and require-library). 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 unit must import plt:userspace^. The plt:userspace^ signature varies depending on the context that the teachpack is loaded in. In DrScheme, it contains:
The last two entries above are the same definitions that appear in the advanced language level. They are linked into the teachpack so the teachpack's code can share state with the user's program, if necessary. To use other libraries, the teachpack author must use a compound unit and link in other libraries.
A teachpack file is always loaded with Graphical Full Scheme 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:mz-userspace^) (define four 4))For more interesting examples, see the htdp directory of the teachpack directory in the PLT installation.