Create an HTML table: Difference between revisions

add BQN
(add BQN)
Line 700:
[[File:HTMLtable_BBC.gif]]
 
=={{header|BQN}}==
Returns a simple string.
 
<code>Tag</code> is a helper function which encloses the left argument in the right argument tag type.
 
<lang bqn>Tag ← {∾"<"‿𝕨‿">"‿𝕩‿"</"‿𝕨‿">"}
 
•Show "table" Tag ∾∾⟜(@+10)¨("tr"Tag∾)¨⟨"th"⊸Tag¨ ""<⊸∾⥊¨"XYZ"⟩∾("td" Tag •Fmt)¨¨ 0‿0‿1‿2 + 1‿3‿3‿3 × 4/⟨↕4⟩</lang><lang bqn>"<table><tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>
<tr><td>0</td><td>1</td><td>2</td><td>3</td></tr>
<tr><td>0</td><td>3</td><td>6</td><td>9</td></tr>
<tr><td>1</td><td>4</td><td>7</td><td>10</td></tr>
<tr><td>2</td><td>5</td><td>8</td><td>11</td></tr>
</table>"</lang>
=={{header|Bracmat}}==
To make this interesting, the table is created as a Bracmat structure and then converted to XML by a library. This has the advantage that one doesn't have to worry about HTML entities and encoding issues. The contents of the cells are generated by a function that is instantiated with a starting number when the function makeTable is called. Notice the absence of loops.
236

edits