We can write a simple function to create HTML and pass that to a browser.

tag←{
     ⍺←'p'
     0∊⍴⍵:''
     (tg style)←{⎕ML←1
         ' '∊⍵:⍵{(⍵↑⍺)(⍵↓⍺)}¯1+⍵⍳' '
         ⍵''}⍺
     '<',tg,style,'>',(('<'=1⍴⍵)/nl),⍵,'</',tg,'>',nl
 }

     ∇ CreateHtml;htmlCode;body;head
[1]    body←'body'tag('h1'tag'"Hello World with APL in HTML'),('h2'tag'hello...'),tag'...world'
[2]    head←'head'tag('title'tag'Hello world with APL'),(''tag'')
[3]    htmlCode←'html'tag head,body
[4]    htmlCode{(⎕NUNTIE ⍵){}⍺ ⎕NAPPEND ⍵}'helloworld.html'⎕NCREATE 0

Below is the output HTML from the above function.

<html>
<head>
<title>Hello world with APL</title>
</head>
<body>
<h1>"Hello World with APL in HTML</h1>
<h2>hello...</h2>
<p>...world</p>
</body>
</html>

And here is what a browser makes of it.

helloworldhtml.jpg

Page created by Phil Last at 2008-02-26

CategoryHelloWorld CategoryDyalog