UP | HOME

Howto get APL symbols (and others) at your fingertips

Table of Contents

APL and the funny symbols   APL

APL and its dialects (f.e. Dyalog APL) use funny symbols:

⍝ Conway's Game of Life by John Scholes
life ← {⊃1 ⍵ ∨.∧ 3 4 = +/ +⌿ ¯1 0 1 ∘.⊖ ¯1 0 1 ⌽¨ ⊂⍵}

APL (=A Programming Language, also short for Array Programming Language) is a very interesting way to describe (and actually program) algorithms. Notation as a tool of thought1. For more details about APL, have a look at the APLWiki. A fantastic open source implementation mimicking APL2 is GNU APL.

But, quite a challenge for the novice, howto get this symbols at your keyboard. In the past this was quite a thing - you needed special graphics adapters and keyboards, but today in the time of unicode it is not that difficult. One way - to access ⍺,≡,∇,∆ and their other friends - is to have a specific keyboard layout that supports these characters, f.e. see Typing glyphs on Linux at the APLWiki or APL Fonts and Keyboards at Dyalog.

Another way, the one that I chose, and least for X Window (unix/linux) and MacOS seems less effort, is to utilize a compose-key.

Unix/Linux: X Window and .XCompose

Simply put a proper .XCompose file into your home directory. Restart your application, and whatever you defined in your .XCompose file is available. No need to restart your xwindow server. As I type quite often APL-symbols, I chose <period> as an extra compose key.

As an example, my .XCompose file:

# APL Characters
# https://www.x.org/releases/X11R7.7/doc/libX11/i18n/compose/en_US.UTF-8.html
include "%L"

<period> <period>          : "."
<period> <dead_grave>      : "⋄"
<period> s                 : "⌈"
<period> <exclam>          : "⌶"
<period> <1>               : "¨"
<period> <at>              : "⍫"
<period> <2>               : "¯"
<period> <numbersign>      : "⍒"
<period> <3>               : "<"
<period> <dollar>          : "⍋"
<period> <4>               : "≤"
<period> <percent>         : "⌽"
<period> <5>               : "="
<period> <dead_circumflex> : "⍉"
<period> <asciicircum>     : "⍉"
<period> <6>               : "≥"
<period> <ampersand>       : "⊖"
<period> <7>               : ">"
<period> <asterisk>        : "⍟"
<period> <8>               : "≠"
<period> <parenleft>       : "⍱"
<period> <9>               : "∨"
<period> <parenright>      : "⍲"
<period> <0>               : "∧"
<period> <underscore>      : "!"
<period> <minus>           : "×"
<period> <plus>            : "⌹"
<period> <equal>           : "÷"
<period> <q>               : "?"
<period> <W>               : "⍹"
<period> <w>               : "⍵"
<period> <E>               : "⍷"
<period> <e>               : "∊"
<period> <r>               : "⍴"
<period> <T>               : "⍨"
<period> <t>               : "~"
<period> <Y>               : "¥"
<period> <y>               : "↑"
<period> <u>               : "↓"
<period> <I>               : "⍸"
<period> <i>               : "⍳"
<period> <O>               : "⍥"
<period> <o>               : "○"
<period> <P>               : "⍣"
<period> <p>               : "⋆"
<period> <braceleft>       : "⍞"
<period> <bracketleft>     : "←"
<period> <braceright>      : "⍬"
<period> <bracketright>    : "→"
<period> <bar>             : "⊣"
<period> <backslash>       : "⊢"
<period> <A>               : "⍶"
<period> <a>               : "⍺"
<period> <s>               : "⌈"
<period> <d>               : "⌊"
<period> <F>               : "⍫"
<period> <f>               : "_"
<period> <g>               : "∇"
<period> <H>               : "⍙"
<period> <h>               : "∆"
<period> <J>               : "⍤"
<period> <j>               : "∘"
<period> <K>               : "⌺"
<period> <k>               : "'"
<period> <L>               : "⌷"
<period> <l>               : "⎕"
<period> <colon>           : "≡"
<period> <semicolon>       : "⍎"
<period> <quotedbl>        : "≢"
<period> <apostrophe>      : "⍕"
<period> <z>               : "⊂"
<period> <Z>               : "⊆"
<period> <X>               : "χ"
<period> <x>               : "⊃"
<period> <C>               : "⍧"
<period> <c>               : "∩"
<period> <v>               : "∪"
<period> <B>               : "£"
<period> <b>               : "⊥"
<period> <n>               : "⊤"
<period> <m>               : "|"
<period> <less>            : "⍪"
<period> <comma>           : "⍝"
<period> <greater>         : "⍀"
<period> <question>        : "⍠"
<period> <slash>           : "⌿"
<period> <adiaeresis>      : "⋄"
<period> <asciitilde>      : "⋄"
<period> <odiaeresis>      : "]"
<period> <Adiaeresis>      : "{"
<period> <Odiaeresis>      : "}"
<period> <udiaeresis>      : "←"
<period> <Udiaeresis>      : "→"
<period> <Q> <u>           : "ü"
<period> <Q> <U>           : "Ü"
<period> <Q> <a>           : "ä"
<period> <Q> <A>           : "Ä"
<period> <Q> <o>           : "ö"
<period> <Q> <O>           : "Ö"
<period> <Q> <s>           : "ß"
<period> <Q> <e>           : "€"
<period> <M> <F> <G>       : "mit freundlichen Grüßen - Florian"
<period> <M> <f> <g>       : "best regards - Florian"

You see, quite simple, and not limited to special chars, you can also include abbreviations for often used phrases.

You don't have to care about your keyboard layout. Dvorak or QWERTY? Just have in mind, to get an '∊' simply type '.e'.

MacOSX / OSX

MacOSX offers similar to .XCompose (which you nevertheless need, if you run a Xserver, f.e. XQuartz) the file '~/Library/KeyBindings/DefaultKeyBinding.dict'. See more about this file here and the Apple Developer notes.

See below my DefaultKeyBinding.dict. Unfortunately the situation around this file is not that coherent, as for XCompose under X Window. Some applications (f.e. some QT apps) ignore this file and it seems you can not address all keys.

{
   "." = {
        "." = ("insertText:", ".");
        "!" = ("insertText:", "⌶");
        "1" = ("insertText:", "¨");
        "\U0040" = ("insertText:", "⍫"); /* @  */
        "2" = ("insertText:", "¯");
        "\043" = ("insertText:", "⍒"); /* #  */
        "3" = ("insertText:", "<");
        "\044" = ("insertText:", "⍋"); /* $  */
        "4" = ("insertText:", "≤");
        "%" = ("insertText:", "⌽");
        "5" = ("insertText:", "=");
        "\136" = ("insertText:", "⍉"); /* ^  */
        "6" = ("insertText:", "≥");
        "&" = ("insertText:", "⊖");
        "7" = ("insertText:", ">");
        "*" = ("insertText:", "⍟");
        "8" = ("insertText:", "≠");
        "(" = ("insertText:", "⍱");
        "9" = ("insertText:", "∨");
        ")" = ("insertText:", "⍲");
        "0" = ("insertText:", "∧");
        "_" = ("insertText:", "!");
        "-" = ("insertText:", "×");
        "+" = ("insertText:", "⌹");
        "=" = ("insertText:", "÷");
        "q" = ("insertText:", "?");
        "W" = ("insertText:", "⍹");
        "w" = ("insertText:", "⍵");
        "E" = ("insertText:", "⍷");
        "e" = ("insertText:", "∊");
        "r" = ("insertText:", "⍴");
        "T" = ("insertText:", "⍨");
        "t" = ("insertText:", "∼");
        "Y" = ("insertText:", "¥");
        "y" = ("insertText:", "↑");
        "u" = ("insertText:", "↓");
        "I" = ("insertText:", "⍸");
        "i" = ("insertText:", "⍳");
        "O" = ("insertText:", "⍥");
        "o" = ("insertText:", "○");
        "P" = ("insertText:", "⍣");
        "p" = ("insertText:", "⋆");
        "{" = ("insertText:", "⍞");
        "[" = ("insertText:", "←");
        "}" = ("insertText:", "⍬");
        "]" = ("insertText:", "→");
        "|" = ("insertText:", "⊣");
        "\\" = ("insertText:", "⊢");
        "A" = ("insertText:", "⍶");
        "a" = ("insertText:", "⍺");
        "s" = ("insertText:", "⌈");
        "d" = ("insertText:", "⌊");
        "F" = ("insertText:", "⍫");
        "f" = ("insertText:", "_");
        "g" = ("insertText:", "∇");
        "H" = ("insertText:", "⍙");
        "h" = ("insertText:", "∆");
        "J" = ("insertText:", "⍤");
        "j" = ("insertText:", "∘");
        "K" = ("insertText:", "⌺");
        "k" = ("insertText:", "'");
        "L" = ("insertText:", "⌷");
        "l" = ("insertText:", "⎕");
        ":" = ("insertText:", "≡");
        ";" = ("insertText:", "⍎");
        "\"" = ("insertText:", "≢");
        "'" = ("insertText:", "⍕");
        "z" = ("insertText:", "⊂");
        "Z" = ("insertText:", "⊆");
        "X" = ("insertText:", "χ");
        "x" = ("insertText:", "⊃");
        "C" = ("insertText:", "⍧");
        "c" = ("insertText:", "∩");
        "v" = ("insertText:", "∪");
        "B" = ("insertText:", "£");
        "b" = ("insertText:", "⊥");
        "n" = ("insertText:", "⊤");
        "m" = ("insertText:", "|");
        "<" = ("insertText:", "⍪");
        "," = ("insertText:", "⍝");
        ">" = ("insertText:", "⍀");
        "?" = ("insertText:", "⍠");
        "/" = ("insertText:", "⌿");
        "Q" = {
            "u" = ("insertText:", "ü");
            "U" = ("insertText:", "Ü");
            "a" = ("insertText:", "ä");
            "A" = ("insertText:", "Ä");
            "o" = ("insertText:", "ö");
            "O" = ("insertText:", "Ö");
            "s" = ("insertText:", "ß");
            "e" = ("insertText:", "€");
        };
   };
}

Microsoft Windows

As I try not to use Windows, I am not aware, what would be the best solution for this operating system. If someone has an idea, please send me an email, and I would add this information to this post.

There is wincompose, but I have never used it, so no idea, whether this is a good idea.

Footnotes:

Date: 2022-10-14 Fri 00:00

Author: Otto Diesenbacher-Reinmüller

Validate