CSV to HTML translation: Difference between revisions

Added PicoLisp
(→‎{{header|J}}: add tacit equivalents)
(Added PicoLisp)
Line 425:
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
</table></lang>
 
=={{header|PicoLisp}}==
===Simple solution===
<lang PicoLisp>(load "@lib/http.l")
 
(in "text.csv"
(<table> 'myStyle NIL NIL
(prinl)
(while (split (line) ",")
(<row> NIL (ht:Prin (car @)) (ht:Prin (cadr @)))
(prinl) ) ) )</lang>
Output:
<pre><table class="myStyle">
<tr><td>Character</td><td>Speech</td></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
<tr><td>Brians mother</td><td><angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry></td></tr>
<tr><td>The multitude</td><td>Who are you?</td></tr>
<tr><td>Brians mother</td><td>I'm his mother; that's who!</td></tr>
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
</table></pre>
===Extra credit solution===
<lang PicoLisp>(load "@lib/http.l")
 
(in "text.csv"
(when (split (line) ",")
(<table> 'myStyle NIL (mapcar '((S) (list NIL (pack S))) @)
(prinl)
(while (split (line) ",")
(<row> NIL (ht:Prin (car @)) (ht:Prin (cadr @)))
(prinl) ) ) ) )</lang>
Output:
<pre><table class="myStyle"><tr><th>Character</th><th>Speech</th></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
<tr><td>Brians mother</td><td><angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry></td></tr>
<tr><td>The multitude</td><td>Who are you?</td></tr>
<tr><td>Brians mother</td><td>I'm his mother; that's who!</td></tr>
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
</table></pre>
 
=={{header|Python}}==
Anonymous user