MathML is a markup language based on XML for describing mathematics. Though MathML is human-readable-and-writable, it is human-readable-and-writable in the same sense that XML is human-readable-and-writable. So we have to provide users with methods of combination and abstraction to help them organize ideas about mathematical presentation and content.
SMathML is a DSL embedded in Scheme for expressing MathML (and also HTML), which is based on a hierarchical structure:It also provides a general way inspired by Oleg Kiselyov's SXSLT to create transformations of SXML, which is just a representation of HTML/XML as S-expressions. The boundary between primitive abstractions and user-defined abstractions is intended to be vague and the users are encouraged to create fundamental abstractions to his own taste.
(MB (let ((fib (lambda (n)
(let iter ((a 0) (b 1) (c 0))
(if (= c n)
a
(iter b (+ a b) (+ c 1))))))
(&fib (lambda (n) (app 'fib n)))
(seq (range 13)))
(set-attr*
(&table (list (map &fib seq) (map fib seq)))
'frame "solid" 'rowlines "solid" 'columnlines "solid")))
(MB (&= (^ (@+ $x $y) $n)
(sum (&= $k $0) $n
(&i* (comb $n $k) (^ $x (&- $n $k)) $y^k))))