APL is an interesting language in that a simple hello world program can be done thus :


will cause the typed text within quotes to appear on the terminal. No variables are needed, or print statements. Of course, if you want/need to store it, then:


Typing 'a' causes a's value to be printed.

APL is generally a loopless language. In general, loops like those in other HLLs such as Fortran or C (especially those whose purpose are to step through each item of a list, vector, array, etc.) aren't needed.

So, if we wanted 100 copies of 'hello world' we'd just do:

hello<-100 11 P a

The P (reshape) operator takes a's value and makes a 100x11 array of it, and stores it in hello. Typing 'hello' just prints the value -- 100 copies of 'hello world'!

Of course, if you want infinite loops, then that technique won't work (you don't have infinite storage do you?) then do:

1: 'hello world'
2: ->1

-> is a 'goto'.

The '100 P a' type stuff is not real APL, inasmuch as APL uses special characters, and P is the closest I can get to the APL (rho) operator (greek rho) in Ascii.

submitted by: David Fox (dfox@belvdere.vip.best.com)

{   }'Hello World'

The above line will generate an endless stream of "Hello World" if cut & pasted and then executed in the session of a Dyadic (http://www.dyadic.com/) APL interpreter past version 8. It uses a new Feature of Dyalog APL which is dynamic functions.

The line reads:
open curly-bracket
quad gets omega
del omega
close curly-bracket
Hello World! (or any other fancy message)

Although spaces are added for legibility, none of them is required, except in the quoted string 'Hello World!'. The program will not cause a stack overflow since dynamic functions support tail recursion.

Have fun.

submitted by: Stefano Lanzavecchia (stf@apl.it)