Glyph
Glyphs are the individual characters and symbols used in APL, primarily to represent primitive functions and operators. A glyph is distinct from the functionality it represents, and usually has a different name: for example, the dyadic function Take is represented with the glyph Up Arrow.
Most of APL's glyphs cannot be represented in ASCII, now considered a "standard" or "basic" character set, but all of them are included in Unicode, as one goal of Unicode was to unify existing character sets. In fact, Ken Iverson first began using his notation before work on ASCII began, and APL\360 was implemented before the modern ASCII standard was published in 1967. Prior to the widespread adoption of Unicode, many special purpose code pages were used to represent APL symbols. APLs developed more recently, such as NARS2000 and GNU APL, use Unicode characters to represent glyphs, sometimes supporting several different options for a given glyph. Unicode also offers the possibility of introducing glyphs that could not have been produced on older APL systems: for example, both NARS2000 and dzaima/APL use √
for the Square Root and Root functions.
While Iverson notation was originally handwritten, the choice of glyphs to include in the first APL implementations was influenced by technical constraints of the typewriters used at the time. Notably, many glyphs were produced by overlaying two simpler glyphs, a technique known as overstriking. The original glyph shapes in A Programming Language were drawn by Ken Iverson's wife, Jean Iverson, using a Keuffel and Esser Leroy lettering set.[1]
Alternatives
Display problems have been mostly eliminated by the broad uptake of Unicode. However some difficulties with typing glyphs remain. Several APL-family languages such as J, K, and ELI have chosen to stick with ASCII, either by reducing and compacting functionality to use one character per glyph or by using multiple characters. Historically there have also been various encodings of APL in smaller character sets, typically as an alternate way of writing code for an APL with traditional glyphs.
Bi-glyphs
J and K use both ASCII symbols on their own, and followed by one or more periods and/or colons. J terminology calls these bigraphs and trigraphs. For example, J uses ^
for Power, ^.
for Logarithm, and ^:
for the Power operator, while K uses ':
for the equivalent of pair-wise reduction (¯2f/
) and 0:
for line-by-line file read/write. Lately, J has gone beyond this and added {{
…}}
for explicit functions, similar to the syntax of dfns.
Dyalog APL uses a few bi-glyphs, especially in dops (the operand equivalent of a dfn) where for example ⍺⍺
and ⍵⍵
denote the left and right operands. GNU APL and dzaima/APL use ⍶
and ⍹
instead.
GNU APL also uses bi-glyphs consisting of ⊤
follwed by a comparison function as the bit-wise equivalent of the comparison function. For example A⊤∧B
is bit-wise And. Numbers are treated as 64-bit integers, and characters as 32-bit integers (with the result being character as well).
NARS2000 uses ..
for its Range function.
References
APL features [edit] | |
---|---|
Built-ins | Primitives (functions, operators) ∙ Quad name |
Array model | Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index (Indexing) ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype |
Data types | Number (Boolean, Complex number) ∙ Character (String) ∙ Box ∙ Namespace ∙ Function array |
Concepts and paradigms | Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity element ∙ Complex floor ∙ Array ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ Glyph ∙ Leading axis theory ∙ Major cell search ∙ First-class function |
Errors | LIMIT ERROR ∙ RANK ERROR ∙ SYNTAX ERROR ∙ DOMAIN ERROR ∙ LENGTH ERROR ∙ INDEX ERROR ∙ VALUE ERROR ∙ EVOLUTION ERROR |
APL glyphs [edit] | |
---|---|
Information | Glyph ∙ Typing glyphs (on Linux) ∙ Unicode ∙ Fonts ∙ Mnemonics ∙ Overstrikes ∙ Migration level |
Individual glyphs | Jot (∘ ) ∙ Right Shoe (⊃ ) ∙ Up Arrow (↑ ) ∙ Zilde (⍬ ) ∙ High minus (¯ ) ∙ Dot (. ) ∙ Del (∇ )
|