APL is an under-appreciated language, pioneering many concepts that have re-appeared in almost every language since. Iverson Ghosts! Boo.
A huge hurdle for new users is those funny symbols. How does one enter them on a modern keyboard?
Wonder no longer! It's not so tough, just not documented that well on the web today. APL has its own Unicode point so all the symbols are already inside your box waiting to be used. One can even use GNU APL on an Android phone or tablet with the Hacker's Keyboard (fork for APL layout, see bottom)
One would think APL enthusiasts would have keymaps with an easy setup script to run, to encourage newcomers, but I guess not since I didn't run across any... so here's my attempt to help out any other APL-curious people out there.
BONUS: Hard-to-find APL book links. These books are out of print and insanely expensive on the used market. I manually scanned in APL2 At A Glance to save it for posterity. It really is the best introductory text for APL2.
APL2 At a Glance (English)
APL2 Ein erster Einblick (APL2 At A Glance, German)
APL2 In Depth
Adding an APL Keymap to X terminals
From X (any windowed terminal, eg. Konsole, xfce4-terminal etc.)
--
My preferred setup uses CAPS LOCK as the APL key:
setxkbmap us,apl -option grp:caps_switch
Try the above interactively, then put it into your .bashrc and you're good to go. If you *really* need CAPS LOCK for some reason, ALT+CAPS works.
One might also be able to define it system-wide via an xorg.conf.d/ file such as the following snippet, but I haven't rebooted yet to test it:
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us,apl"
Option "XkbModel" "pc104"
#Option "XkbVariant" ",dvorak"
Option "XkbOptions" "grp:caps_switch"
EndSection
APL Keys For 'dfns' (lambdas)
Dyalog APL and GNU APL both use the ⍺ and ⍵ symbols for the unbound left- and right-hand variables of 'dfns' (basically lambda functions). These are standard for both APL dialects, but GNU APL also recognizes APL Functional Symbol alpha-underber, ⍶:U+2376, APL Functional Symbol omega-underbar, ⍹:U+2379 and lowercase Greek chi, χ:U+03C7.
On my Dell XPS 15 laptop, it seems using the CAPS key as the APL COMPOSE in combination with the SHIFT key does not work for the W/S/X key column. So I chose the U and C keys as alternates to yield omega-underbar and chi, respectively, instead, as Dyalog and GNU APL don't appear to have anything assigned to those with SHIFT. Modifications to my .Xmodmap are thus as follows:
keycode 25 = w W U2375 U2379
keycode 38 = a A U237A U2376
keycode 30 = u U U2193 U2379
keycode 53 = x X U2283 U03C7
keycode 54 = c C U2229 U03C7
.. and yet on my Acer Aspire, keys W and X work just fine. Weird.
To customize your X modmap (be sure you've already added the ,apl to your xkbmap above):
$ xmodmap -pke >~/.Xmodmap
$ vi .Xmodmap ## editing the above
$ xmodmap ~/.Xmodmap # To reload
Download my .Xmodmap keymap file here:
APL Linux Console Key Map
Download my console keymap file here:
https://www.blitter.com/nextcloud/index.php/s/9oY7pEbDZeiZNfq
As root,
# loadkeys APL.kmap
Almost the same as the X mapping -- CAPS LOCK and shift+CAPS LOCK are combo keys with any other key in the GNU APL mapping for APL symbols; right-ALT is APL-mode lock.
APL fonts require running within an 'fbterm' on virtual consoles, so install that first, and if you want to use APL from the console often, start 'fbterm' and 'loadkeys' from startup.
GNU APL on Android with TermUX
* open TermUX.
* Make sure you have lots of free space on your phone, as you're going to be building GNU APL from source using g++
$ apt-get install subversion
$ apt-get install g++
## might need autotools and other things as well (automake, autoconf, etc.)
$ svn checkout svn://savannah.gnu.org/apl $ cd apl/trunk
You may have issues with network timeouts checking out the repo. If so, retry after running an svn cleanup. if you keep having trouble, fetch it on a PC Linux machine, tar+gzip the whole svn/trunk dir and then use 'scp' to just copy it to your TermUX home dir (either by installing openssh in TermUX or using an Android ssh program... but you'll have to hunt around in your phone's filesystem to find your TermUX home dir in that case...)
[Again, within TermUX]:
$ apt-get install ncurses pcre pcre2
$ cd trunk/ # wherever gnu apl source from svn was fetched
$ ./configure
$ make
$ mkdir $HOME/bin
$ cp src/apl $HOME/bin
$ export PATH=$HOME/bin:$PATH ## or set up a .bashrc or .profile with this to make it permanent
.. I might have missed a few apt-get calls required for some libraries but otherwise it did build just fine right on the phone!
Oh, and remove the svn/trunk afterwards because you'll probably be low on space :)
Finally, install the fork of Hacker's Keyboard with APL layout/language available here!