making the example look nicer.

This commit is contained in:
Danny Yoo 2011-07-11 22:02:54 -04:00
parent c13d181361
commit e4c91b3917
2 changed files with 7 additions and 9 deletions

View File

@ -8,4 +8,4 @@
(* x (fact (sub1 x)))])) (* x (fact (sub1 x)))]))
(printf "test: ~s\n" (fact 4)) ;;(printf "test: ~s\n" (fact 4))

View File

@ -3,29 +3,27 @@
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="fact.js"></script> <script src="fact.js"></script>
<script>
plt.runtime.invokeMains();
</script>
<script> <script>
plt.runtime.invokeMains();
plt.runtime.ready(function() { plt.runtime.ready(function() {
var myFactClosure = plt.runtime.lookupInMains('fact'); var myFactClosure = plt.runtime.lookupInMains('fact');
var myFact = plt.baselib.functions.asJavaScriptFunction( var myFact = plt.baselib.functions.asJavaScriptFunction(
myFactClosure); myFactClosure);
$(document.body).append("The factorial of 1000 is: ");
myFact(function(v) { myFact(function(v) {
$(document.body).append(v.toString()); $('#answer').text(v.toString());
}, },
function(err) { function(err) {
$(document.body).append(err); $('#answer').text(err.message);
}, },
1000); 10000);
}); });
</script> </script>
</head> </head>
<body> <body>
The factorial of 10000 is <span id="answer">being computed</span>.
</body> </body>
</html> </html>