2 Start with held data
The mathematical layer uses ordinary scalar S-expressions with an immutable sidecar for context and occurrence identity. It does not introduce a second mathematical expression hierarchy. A mathematical derivation is independent of how its steps are timed, typeset, and animated.
(require animate/math animate/math/render) (define problem (math '(= (+ (* 3 x) 5) 17) #:id 'lesson #:context (math-context #:real '(x)))) (define solution (derive problem [subtract-five (both-sides 'subtract 5)] [cancel-five (cancel-addends #:at (lhs))] [evaluate-twelve (evaluate #:at (rhs))])) (define plan (present solution #:groups '((subtract-five cancel-five evaluate-twelve)))) (define scene (math-plan->scene! plan))
Constructing the mathematical data above performs no typesetting. The final conversion is explicitly effectful. Once compiled, native scene sampling does not call a CAS, run TeX, or replay earlier frames.