<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
<math xmlns="http://www.w3.org/1998/Math/MathML"
      xmlns:html="http://www.w3.org/1999/xhtml">
<!--
  <declare>
    <ci>f</ci>
    <lambda>
      <bvar><ci>x</ci></bvar>
      <apply>
        <minus/>
        <apply>
          <power/>
          <ci>x</ci>
          <cn>2</cn>
        </apply>
        <cn>3</cn>
      </apply>
    </lambda>
  </declare>

  <apply>
    <f/>
    <cn>42</cn>
  </apply>

  <apply>
    <f/>
    <cn>3</cn>
  </apply>
-->

  <declare>
    <ci>make-multiplier</ci>
    <lambda>
      <bvar><ci>x</ci></bvar>
      <lambda>
        <bvar><ci>y</ci></bvar>
        <apply>
          <multiply/>
          <ci>x</ci>
          <ci>y</ci>
        </apply>
      </lambda>
    </lambda>
  </declare>

  <declare>
    <ci>times-ten</ci>
    <apply>
      <make-multiplier/>
      <cn>10</cn>
    </apply>
  </declare>

  <apply>
    <times-ten/>
    <cn>5</cn>
  </apply>

  <apply>
    <times-ten/>
    <ci>pi</ci>
  </apply>
      
  <!-- TODO: convert this to an xhtml document with embedded mathml so that firefox can display the mathml properly -->
  <!-- TODO: create a nice read-eval-print loop that evals the user's choice of mathml nodes and puts the result into the document -->

  <html:script type="application/javascript" src="http://weblogs.mozillazine.org/weirdal/math/removeWhitespace.js"/>
  <html:script type="application/javascript" src="matheval.js"/>
  <html:script type="application/javascript"><![CDATA[
window.addEventListener("load", function runTest() {
  removeWhitespaceByNamespace(document, "http://www.w3.org/1998/Math/MathML");

  //evalMath(document.documentElement.firstChild, initial_environment);
  evalMath(document.documentElement.childNodes[1], initial_environment);
  evalMath(document.documentElement.childNodes[2], initial_environment);

  result = evalMath(document.documentElement.childNodes[3], initial_environment);
  alert(result);

  result = evalMath(document.documentElement.childNodes[4], initial_environment);
  alert(result);

}, false);
  ]]></html:script>
</math>
