html - Produce HTML code for Tranquility
html( s )
html() sends the HTML code in the argument string s to the HTML window for Tranquility.
Like other Tranquility functions that create HTML elements, html() opens a new browser window when called if one did not previously exist.
Elements in s will be placed on the HTML page, left to right, top to bottom in order of being called.
html() has no return value.
The following
example from page 7 of the Tranquility Programmer’s
Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf
creates a table of factorials.
fun fact(n) { if .n == 0 { return 1 } else { return .n * fact(.n - 1) } } fun genfacts(n) { var i, ftab ftab : alloc(.n) i : 0 loop { until .i >= .n (.ftab + .i) : fact(.i) i : .i + 1 } return .ftab } fun filltable() { var i, ftab, istr html("<center>0) html("<table border=1><tr><th>n</th><th>n!</th></tr>0) ftab : genfacts(13) istr : alloc(12) i : 0 loop { until .i > 12 html("<tr><td>") i2s(.istr, .i) html(.istr) html("</td><td>") i2s(.istr, .(.ftab + .i)) html(.istr) html("</td></tr>0) i : .i + 1 } html("</table></center>0) } fun init () { html("<center>") button("Make Table", filltable) html("<p>Factorials</p>0/center>0) }
Charlie Stuart cstuart11@protonmail.com
First, check
the Tranquility Programmer’s Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf
If the problem persists see Dr. Stuart or Charlie Stuart
Dr. Stuart:
brian.l.stuart@drexel.edu
Charlie Stuart:
cstuart11@protonmail.com
tranqc(1), button(3), makeimg(3), makelabel(3), maketable(3)
Tranquility
Programmer’s Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf