APL

From OLPC
Jump to: navigation, search

APL is A Programming Language with its own special character set combining Greek letters, math symbols, and more. Its characters do not have a Unicode block of their own, but are scattered widely. Here are the APL characters included in Unicode, with their Unicode block names.

A-Z, 0-9, !?()[]',.:/\-_ (ASCII)

¨ ¯ (Latin-1)

α ε ι ρ ω (Greek)

← ↑ → ↓ (Arrows)

+ < = > × ÷ ∆ ∇ ∗ ∘ ∣ ∧ ∨ ∩ ∪ ∼ ⊂ ⊃ ⊢ ⊣ ⊤ ⊥ (Math)

⌶ ⌷ ⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍈ ⍉ ⍊ ⍋ ⍌ ⍎ ⍏
⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗ ⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧
⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍶ ⍷ ⍸ ⍹ (Miscellaneous Technical Symbols)

◇ (Block Elements & Geometric Shapes)

A number of APL characters were originally produced by overstriking characters from the base set (originally 88 characters on Selectric typeballs, later extended to 94 in the APL-ASCII overlay mappings). In later APL software, there is support for typing the previously overstruck characters as single characters, typically using the Control or Alt key as a modifier. All APL symbols are included in Unicode, but not in a single block.

The A+ dialect of APL is available in most Linux distributions. It includes its own APL font.

There is no complete standard APL keyboard. Most vendors use either the typewriter-paired or bit-paired overlay layout for the basic symbols, but there is no agreement whatever on the locations of any composite symbols that are provided without overstriking.

APL is a highly mathematical language, which gives it limited appeal in spite of its power. It has been applied to almost everything in computing except writing device drivers, and has been taught in elementary schools.

J language

Ken Iverson, the original inventor of APL, later invented the J language, which recasts the core ideas of APL using just the ASCII character set. J was released under GPL3 in March, 2011. It is available for [download from http://www.jsoftware.com/stable.htm J Software] in either source code or precompiled form, for 32-bit or 64-bit Intel and AMD processors, on Windows, Macintosh, and Linux. A Debian package is in preparation.

Here is a quick introduction to J. These examples can also be written in APL with very little change other than character substitution.

   NB. The NB. primitive marks comments, which are not executed. [APL ⍝]
   NB. The interpreter indents three spaces to accept user input. Output starts at the left margin.
   1  NB. The result of any input line is printed as output.
1
   1+2  NB. J has standard arithmetic functions.
3
   1-2  NB. The negative sign is _. [APL ¯]
_1
   1%2  NB. No division sign in ASCII [APL ÷]
0.5
   1 2  NB. Arrays (nouns) are first-class data objects in J
1 2
   a =. 1 2  NB. Assignment to a variable (pronoun). No value is displayed.
   a + 2 3  NB. You can apply functions (verbs) to whole arrays without looping.
3 5
   a + 4 NB. Adding one item to each item of an array.
5 6
   #a  NB. Number of items in an array. [APL ρ]
2
   i. 10 NB. First 10 numbers [APL ι]
0 1 2 3 4 5 6 7 8 9
   x*x=. i. 10  NB. Squares [APL ×]
0 1 4 9 16 25 36 49 64 81
   x*/x  NB. Multiplication table [APL ∘.×]
0 0  0  0  0  0  0  0  0  0
0 1  2  3  4  5  6  7  8  9
0 2  4  6  8 10 12 14 16 18
0 3  6  9 12 15 18 21 24 27
0 4  8 12 16 20 24 28 32 36
0 5 10 15 20 25 30 35 40 45
0 6 12 18 24 30 36 42 48 54
0 7 14 21 28 35 42 49 56 63
0 8 16 24 32 40 48 56 64 72
0 9 18 27 36 45 54 63 72 81