Step 0 : Preliminaries
The structure of your local directory of exercises must follow a specific shape, illustrated by the following ascii art:
.
├── exercises
│ ├── exercise1
│ │ ├── descr.html
│ │ ├── meta.json
│ │ ├── prelude.ml
│ │ ├── prepare.ml
│ │ ├── solution.ml
│ │ ├── template.ml
│ │ └── test.ml
│ ├── exercise2
│ │ ├── ...
│ ├── index.json
├── lessons
│ ├── somelesson.json
│ └── lessons.json
├── tutorials
│ ├── index.json
│ ├── some-tutorial.html
│ ├── some-other-tutorial.md
The complete format specification for exercise description is given in docs/exercises_format.md.
- The directory
exercisesmust contain the descriptions of the exercises. Each exercise description is stored in a dedicated subdirectory. On this example, the directoryexercisescontain two exercisesexo1andexo2. The fileindex.jsonputs some structure over this set of exercises, for instance:
{
"learnocaml_version": "1",
"groups":
{ "group1":
{
"title": "Some group of exercises",
"exercises": [ "exo1", "exo2" ]
}
}
}
-
An exercise description is composed of 8 files.
-
descr.htmlcontains the exercise statement as a sequence of HTML elements (that can be grafted in adiv). -
meta.jsoncontains metadata about the exercise including the title of the exercise. -
prelude.mlis an OCaml code fragment loaded in the toplevel before the student answer. -
prepare.mlis an OCaml code fragment inserted after the prelude when the student answer is graded and hidden to the student. -
solution.mlis your answer to the exercise. -
template.mlis the OCaml code fragment that initializes a fresh student answer. -
test.mlis the grader code. -
lessonsandtutorialsare ignored in this tutorial.
Do it yourself!
Reproduce this structure in your own exercise directory. For the moment, your list of exercises is probably empty but it will be populated by the next step of this tutorial.