= Creating a simple HTML page using APL = We can write a simple function to create HTML and pass that to a browser in order to display our Hello World example. Here's the function in Dyalog APL: {{{ tag←{ ⍺←'p' 0∊⍴⍵:'' (tg style)←{⎕ML←1 ' '∊⍵:⍵{(⍵↑⍺)(⍵↓⍺)}¯1+⍵⍳' ' ⍵''}⍺ '<',tg,style,'>',(('<'=1⍴⍵)/nl),⍵,'',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 ∇ }}} And here's an example in APL+Win: {{{ ∇R←tagname tag contents [1] :If 0=⎕nc 'tagname' [2] tagname←'p' ⍝ Left argument defaults to 'p' for paragraph [3] :EndIf [4] :If 0=⍴contents [5] R←'' [6] :Else [7] R←'<',tagname,'>',(('<'=1⍴contents)/⎕L),contents,'',⎕L [8] :EndIf ∇ ∇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] 'helloworld.html' ⎕NCREATE 1 ⋄ htmlCode ⎕NWRITE 1 4 ⋄ ⎕NUNTIE 1 ∇ }}} Below is the output HTML from the above function {{{ Hello world with APL

"Hello World with APL in HTML

hello...

...world

}}} And here is what a browser makes of it. {{attachment:helloworldhtml.jpg}} Page created by Phil Last at 2008-02-26 ---- CategoryHelloWorld - CategoryDyalog