sw-apl

  

sw-apl

An APL session, compiled to WebAssembly and running in a worker in this tab. There is no server: nothing typed here leaves your browser, and nothing is sent anywhere.

The keyboard

An IBM 2741 APL keyboard layout

Four ways to enter a glyph

  1. Tap the board. Keyboard shows it. Keys are laid out like the 2741's, so tapping also shows you where the key is. ABC switches to letters and digits.
  2. The 2741 layout. Unshifted letters are capitals; Shift-R is ⍴, Shift-L is ⎕. Hold Alt for the character a key is painted with.
  3. Overstrikes. Ctrl-] strikes the last glyph, so ⍟ is ○, that key, *. On the board, the row under the keys has each overstrike this mode has, one tap each, with the two it is struck from shown small beneath it; the board's BACKSPACE strikes any pair. On the ABC tab, the A̲ key underscores letters: one tap for the next letter, two quick taps to lock it for every letter, and a tap to let go.
  4. Paste. APL pasted in arrives as it is.

The board's special keys

Workspaces

)LIB 1 lists the workspaces sw-apl ships; )LOAD 1 RACE loads one. )SAVE writes library 0 into this browser's own storage, so a saved workspace comes back next time you open this page in this browser -- and is in no other browser and on no other machine.

Other libraries

)LIBS lists the libraries this page reaches: 0 is yours, 1 is what sw-apl ships, and 2 is EXTENDED, the workspaces kept in the sw-apl-workspaces repository. )LIB 2 lists them and )LOAD 2 COURSE loads one. Only library 0 can be saved to.

Help at the prompt

)HELP lists the commands this mode has, and )HELP LOAD (or any command, or )HELP TOPICS) shows a page. )DIALECT says which mode you are in.

Defining and changing functions

∇Z←S W;V opens a new function, and the prompt [1] numbers the line you type next; ∇ closes it. ∇S reopens one. While it is open:

A function name already in use is a DEFN ERROR: )ERASE it, or reopen it with ∇NAME. )HELP EDITOR has the whole list.

Two modes

The tabs at the top are the modes, and the page opens in Ⓑ '75 until you choose the other. Ⓐ '70 is APL\360-inspired. Ⓑ '75 is IBM 5100-inspired: it adds execute ⍎ and the quad system variables and functions such as ⎕IO and ⎕FX, and has no I-beams and no )ORIGIN, )DIGITS or )WIDTH. Each mode lists and loads only the workspaces that run in it. Switching starts a new session in a clear workspace, so )SAVE first what you want to keep.

With the network off

Once this page has loaded, sw-apl runs without the network: the interpreter is here in the tab, and workspaces you save are kept in this browser. Reload it offline, or open it from your home screen, and it starts as before; offline at the foot of the page says the network is off. Library 2 comes from another repository, so it is there offline only if it was reached before. Online, the page always takes the newest build.

If it says there is no shared memory

The interpreter stops and waits for a line, which needs a SharedArrayBuffer, which a browser grants only to an isolated page. Served locally by just demo or just pages-serve, that is two headers and it simply works. A static host will not send them, so the published page installs a service worker to add them and loads once more under it. If the browser will not install it, the page clears out what this site left in the browser and tries again before it gives up; the words after the colon say why it stopped.

Credits

The keyboard picture is by Rursus, under CC BY-SA 3.0; the glyphs are drawn in APL385 Unicode, by Adrian Smith, public domain. The terms travel with them, in apl-keyboard and apl385-font.

What this browser said, to send with a report:

Switch to ?

The session starts again in the other mode, in a clear workspace: the workspace in hand is not carried across. )SAVE it first to keep it. A saved workspace is listed in the modes it runs in, so one that runs in both is there in either.