User:Ian Clark/APLChars

From J Wiki
Jump to navigation Jump to search

APL chars for reference and code sample composition

In the early days of APL, the character set was hugely extensible. Any image on the teletype terminal printout paper you could invent by backspacing and overtyping was a valid character in the set. Such a character was called an overstruck.

The mechanism allowed for proposed new primitives to be documented and simulated in use prior to implementation. Needless to say, few such overstrucks had primitives attached. But some important primitives, e.g. quote-quad () and Domino (quad-divide) () were always typed in this way.

When VDUs replaced teletype terminals, the facility for superimposing glyphs disappeared. The potential character set was therefore greatly restricted, because a glyph on the screen needed to correspond to a single byte (8-bit code).

With 256 bytes to play with, APL vendors faced the problem of allocating bytes to the primitives they wanted to support, and different vendors adopted different encodings. Some look capricious to today's eyes, playing scant regard to more widely used encoding standards such as ASCII or (IBM's) EBCDIC.

A given encoding was known by the baffling jargon term of atomic vector. Typically a given atomic vector was exhibited as a 16-by-16 table of glyphs, as shown below. This layout table could be generated in the APL session by the expression:

      16 16⍴⎕AV

which roughly corresponds to the J expression:

   16 16 $ a.

Displaying the first two rows is often problematic due to the presence of Null, Linend, Backspace and other terminal control characters.

Modern APLs typically support Unicode, which offers APL glyphs with code points in a number of different code ranges, notably U+2300-U+23FF (Miscellaneous Technical).

Thus ⎕AV has become obsolete. it is provided only to support heritage code, which often needs to convert characters to numbers and back again by using ⎕AV as a lookup table.

A typical APL character set

This is the layout table of Dyalog APL version 12 [1], chosen because it has one of the richest sets of APL primitives of any commercial APL:

pqrstuvwxyz  ¯.⍬
0123456789 ¤¥$£¢
⍪≡≢óôöø"# &’┘┐┌└
:⍷¿¡⋄←→⍝)]¬ §⎕⍞⍣

Below is a screen-shot of the above, taken on a Macintosh under Firefox.
If font: APL385 Unicode has been installed correctly you should see the same characters in the two displays.


Click to download font: APL385 Unicode

For further details see: Typesetting/APL Fonts

To investigate the usage of Unicode chars, the script cu.ijs ("see-unicode") shows you full details of any Unicode glyph you are able to copy/paste: Guides/UnicodeGettingStarted

To experiment with APL chars in the IJS or IJX window of j602, the script apal.ijs gives you an on-screen "keyboard" to "type-in" chars: User:Ian Clark/AplPalette

It also has the extended Latin characters used by French, German, Spanish and Scandinavian languages, and is useful for that purpose too.

-- Ian Clark <<DateTime(2013-04-14T05:31:16Z)>>