SMathML Reference

1    Introduction

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:[user-defined abstractions][primitive abstractions][SXML][HTML/XML].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.

2    Basic Elements of SMathML

3    Transformations of SMathML

4    Examples

4.1   The Fibonacci Sequence

(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")))
fib(0)fib(1)fib(2)fib(3)fib(4)fib(5)fib(6)fib(7)fib(8)fib(9)fib(10)fib(11)fib(12)01123581321345589144

4.2   The Binomial Theorem

(MB (&= (^ (@+ $x $y) $n)
        (sum (&= $k $0) $n
             (&i* (comb $n $k) (^ $x (&- $n $k)) $y^k))))
(x+y)n=k=0n(nk)xnkyk

5    Remarks