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

Exported

Each exported name is documented on the page where it is explained in context:

namewhat it ispage
@giac_strthe giac"…" literalMath input
gmath, gdisplaytypeset a Giac expression in Markdown proseMath input
Mathfieldthe MathLive @bind controlMath input
mathfield_to_giacMathJSON → GiacExprMath input
giac_src_to_texGIAC source → LaTeX (the display side of the bridge)Math input
mathjson_to_giac_srcMathJSON → GIAC source (the write-back side)Math input
checkgrade one exerciseAutograding
gradegrade a whole sectionAutograding
course_reportroll every section into one overviewAutograding

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.expectFunction
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.

source
GiacSlate.expect_symbolicFunction
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.

source
GiacSlate.passFunction

A passing/failing check with a short label and optional detail line.

source

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.