API reference
Everything GiacSlate exports, plus the internals a lesson author needs.
The public surface is deliberately small. The notebooks only ever call the ten exported names below; everything else — the front-end registration, the MathJSON walk, the score card rendering — wires itself up on using GiacSlate and is not meant to be called directly.
Index
GiacSlate.expectGiacSlate.expect_symbolicGiacSlate.passGiacSlate.propertyGiacSlate.register!GiacSlate.MathfieldGiacSlate.gdisplayGiacSlate.giac_src_to_texGiacSlate.gmathGiacSlate.mathfield_to_giacGiacSlate.mathjson_to_giac_srcGiacSlate.@giac_strGiacSlate.checkGiacSlate.course_reportGiacSlate.grade
Exported
Each exported name is documented on the page where it is explained in context:
| name | what it is | page |
|---|---|---|
@giac_str | the giac"…" literal | Math input |
gmath, gdisplay | typeset a Giac expression in Markdown prose | Math input |
Mathfield | the MathLive @bind control | Math input |
mathfield_to_giac | MathJSON → GiacExpr | Math input |
giac_src_to_tex | GIAC source → LaTeX (the display side of the bridge) | Math input |
mathjson_to_giac_src | MathJSON → GIAC source (the write-back side) | Math input |
check | grade one exercise | Autograding |
grade | grade a whole section | Autograding |
course_report | roll every section into one overview | Autograding |
For lesson authors
These are not exported — reach them as GiacSlate.expect and so on — but they are the building blocks of a lesson file, and they are stable enough to document. See Autograding for how they fit together.
GiacSlate.expect — Function
expect(label, impl, ref, cases; atol, rtol, hint, reveal)Run the student function impl on each argument tuple in cases and compare against ref with numeric tolerance. Emits one Check per case.
GiacSlate.expect_symbolic — Function
expect_symbolic(label, student, reference; hint, reveal)Grade a symbolic answer: pass iff Giac simplifies student - reference to 0. By default the correct closed form is NOT revealed on a wrong answer (the point of the exercise) — set reveal = true to show it.
GiacSlate.property — Function
A single boolean assertion as a Check.
GiacSlate.register! — Function
Register (or replace) a section so check/grade/course_report can find it.
GiacSlate.pass — Function
A passing/failing check with a short label and optional detail line.
A lesson also uses two plain structs, whose fields are their whole interface:
Section(id::Symbol, title::String, blurb::String, exercises::Vector{Exercise})
Exercise(key::Symbol, title::String, hint::String, run::Function)blurb is shown once the section is fully solved; key is the keyword a reader passes to check or grade; run maps an answer to a Vector{Check} — in practice a call to expect_symbolic, expect, or property.
Not part of the API
Worth naming explicitly, because they are visible in the source and it would be reasonable to assume otherwise:
GiacSlate.__slate_frontend— the package-global hook Slate calls to install the editor extension and the two bridge handlers. Slate calls it; you do not.GiacSlate.MathfieldButton— the∫cell-toolbar action, registered by that hook._canon_src,_giac_src,_clean_symbol,_giac_fn— the canonicalisation and MathJSON-walk internals. Their behaviour is described in Math input, but their signatures are not stable.Check,ExResult,GradeReport,CourseReport— the grader's result types. They exist to be rendered as a score card, not to be inspected.