A Lab file has a header defining various nouns, followed by one or more chapters that start with lines beginning
Lab Chapter followed by the chapter name. If there is only one chapter, the line
Lab Chapter need not be given.
Each chapter consists of sections that start with lines beginning
Lab Section optionally followed by a section title. Where the section title is not given, it is assumed to be a continuation of the previous section.
The header is executed as a script in the
jlab locale, and may be used to define the following nouns:
Title (must be given first)
Author (optional, may include address, email etc.)
1=continue after errors in code (default 0)
Return focus to session after advancing the lab
1=no output to J session (default 0)
Text width (default 61)
1=run Lab with text in a window (default 1)
1=wrap text to LABWIDTH (default 1)
The title and author (if given) are shown when the lab is run.
Comments are not shown when the lab is started.
Continue after errors should be on if you intend to demonstrate errors in your J code, otherwise errors are signalled to the user. By default this is 0 (off).
Set no session output if you do not want to write to the J execution session. This may be appropriate for labs where there are no code examples; the labs may still contain code within keywords.
Run in window shows the lab text in a window. By default this is 1 (on); you may want to set this off for labs that create their own windows.
Text wrap and text width: by default text wrap is on, and means that any text output to the J execution window is wrapped to the specified text width (default 61).
The header may also contain any other required definitions, such as initialization code that is to be run at the beginning of each chapter. You can invoke any such definitions within
PREPARE keywords in the first section of the chapter (see below). Since the header is defined in the jlab locale, subsequent references must use the full locale name.
Chapters are delimited by a line beginning
Lab Chapter, for example:
Lab Chapter Function Rank