Running the Xor2 Neural-network in sAPL on an iPad-1. The function "Actnet" takes "Example", and uses Wtab1 (a matrix), and Wtab2 (a column vector) and Btab (biases) to activate a simple neural-network, trained using Xerion. The "Example" matrix is a simple boolean exclusive-or, as shown in the 4x4 matrix at screen bottom.

Our small planet, as seen from the ISS (International Space Station) HDEV cameras, but with a bunch of sAPL code overlaid on the image. I've been messing about with how I want the market characterization vector to look like - playing with ideas for using a boolean vector to describe subsequence mkt conditions - ie. what the NN will train to identify. Looked at xkcd cartoon #540. It has little boolean matrix in bottom right corner. So I use sAPL to translate. (sAPL is the Sharp APL interpreter that ran on an Amdahl - but converted to run on an emulator, which runs on an X86. With gDOSbox running on the iPad, emulating an X86 running DOS, sAPL can run on the iPad, on any Android device (it's in the Playstore - totally free, no adverts), and a zipped version is on my github account, which will run on any Windows version, in cmd shell. It will also run on Linux, under DOSemu (CentOS, Fedora tested). Tiny workspace, but accurate numbers. ) Since the sAPL quadAV (atomic vector) is from an EBCDIC machine, I had to write a "genascii" function to create the 128 long ascii vector. Probably one of the more silly things I've done in years. Since I wrote one to translate boolean to ascii, I had to write the flipside, to convert ascii to boolean. For those who are unfamiliar with APL, imagine a mashup of Perl with Python, and then boiled down to very bare essentials, and expressed using single-character greek letters, like mathematicians prefer. The language was conceived by Ken Iverson, implemented by IBM, and before spreadsheets and personal computers, was the #1 internal language at IBM. It also was the first language on the first personal computer, the IBM Scamp (Special Computer APL Machine Portable), released in 1973. Yes, 1973. Google it... I find I still use APL to prototype ideas. (See picture of SCAMP further down the page..)

APL on the iPad

I have hacked and "jailbroken" my iPad Gen-1, and have loaded sAPL on it.  This was the APL product I originally released on the Blackberry Playbook, and remains available for Android devices, from the Google PlayStore. (A Windows Cmd-shell and/or DOSbox version of sAPL is available from the Gemesys Github account, as a .zip file.)   sAPL is a P/C version of the original IP Sharp APL mainframe product, which ran on IBM 370's, and Amdahl V8's.  This iPad version, running under DOSpad, provides a workspace just over 300K.  It is a small, but reliable, implementation of a full APL.

The hack involved jailbreaking the iPad with Redsn0w, which then installs the excellent Cydia environment, which allows installation of all the Linux/Unix utilities, including OpenSSH, related network utilities, and various Linux/Unix utilities such as PSTree, Screen, VIm, etc.   

RedSn0w details:

From the above site, navigate to page bottom, and download the file: "redsn0w 0.9.15b3" for Windows, and note that it needs to be run in Administrator mode.

The first step is to have iTunes installed on your Windows P/C.  You might have to locate drivers for the iPad.  If you have an iPad, you probably have iTunes installed on your machine already.  If not, you have to find it and install it for the jailbread to work.  Note, this process is *completely at the user's own risk*.  That means you should back up anything on the iPad you don't want to lose.  The responsibility for following these steps lies with you as the experimenter.  (This is why I used my old, first-generation iPad.)

The steps for the jailbreak are detailed, and require the iPad to be connected to a Windows P/C. You downlaod the RedSn0w tool and install it on your Windows P/C/. Then, connect your iPad to the P/C, and put the iPad into DFU mode.  This is done by holding the home and power buttons on the iPad for 10 seconds, then release the power button, but keep holding the home button, for another 10 seconds. Then release the power button, and the screen should stay black.  This is the mode where iTunes can update your device.

There are several tutorials on the internet about this process.  Here is a link to one of them: 

    Tutorial on iOS 5.1.1 iPad Jailbreak:

The next step is to obtain and configure the OpenSSH/OpenSSL environment on your Windows box, if you have not already done so.  OpenSSH is the open-source "Secure SHell", it uses SSL ("Secure Socket Layer") and allows you to login to the iPad from your Windows machine, and transfer files to and from the iPad, using SCP, the "Secure CP" program (CP is the unix name for COPY).  The iPad is basically a Debian Linux box, with an Apple-built touch-screen interface.  There are several ways to get SSH/SSL onto your Window P/C.  I used the SSH install code from MLS-Software.  As of May 12, 2016, the most recent SSH-Install-for-Windows from MLS-Software installs OpenSSH 7.2p2, with OpenSSL 1.0.2g, which is current as of March 1st, 2016.  You probably want to keep the OpenSSH version fairly current, as it and OpenSSL are regularly updated to address discovered vulnerabilities. OpenSSH is typically used to login between Windows and Linux boxes.  If you install the SSHD (the Secure SHell Daemon) for Windows on your Windows box, you can login to your Windows machine from both the iPad and other Linux boxes, if your LAN and machine firewalls are set to allow that.  Learn more about SSH:

The SetupSSH Installer for Windows SSH/SSL:

Once you have SSH access to the iPad, the APL executables can be installed as directories in the /var/mobile/Documents folder, where they will show up as available in the C: drive, when DOSpad is started.  You do not need to modify the dospad.cfg file to mount C:, as DOSpad already mounts /var/mobile/Documents as C:.

Confirm you have SSH installed on your Windows box by checking the version number, which will be shown if you use the "-V" option.  Eg: from your Windows box, in a Cmd window, where you see: "C:\> "  enter "ssh -V", and confirm you get: "OpenSSH_7.2p2g, OpenSSL 1.0.2g 1 Mar  2016" in response.  Try a login to root, from Windows.  Note: you have make sure you have assigned an IP# (or your router has given one with DHCP), to the iPad.  Check the settings on the iPad to see what it's IP number is, then use that to log into it.

Login to iPad, with IP#, from Cmd Shell in Windows...

     C:\>  ssh   ( is your IP#,  something like

The root password on a jailbroken iPad is "apline".   Once you are logged in, try an "ls -l" command to list your files.  I run a static IP#'s in my lab.  Each machine is assigned a non-changing IPV4 number. Typically, your router will assign your iPad a temporary IP#.  On your iPad, click Settings, then WiFi, then click the arrow to the far right of your local network name, and you should get a screen that displays your local IP number.  Use that number above to access your iPad. 

Files can be migrated to and from the iPad using "scp", the secure copy program.  The Redsn0w jailbreak results in two available login id's, "root" and "mobile".  Both have original Apple passwords of "alpine".  Download the terminal emulator from Cydia, start it, run "su" and login as root, and use "passwd" to change the default passwords for root and mobile userids as your first task.

Once the jailbreak is complete, and OpenSSH is installed, the DOSpad application has to be installed.  You have to copy  the .DEB file for DOSpad onto the iPad, and run dkpg to install the Debian package file on the iPad.  The .DEB file for DOSpad can be obtained from the site.  URL is: 

DOSpad for iPad: (Cydia version):

The DOSpad source code is on Github, at:

You do not need the source code to do this, but it is available if one is curious.

To install a .DEB file, there are again a few different methods.  I used "scp" to copy the "dospad.deb" file to the iPad directory /var/root/Media/AutoInstalI, which is Method#2 in the tutorial link.  You might have to create the AutoInstall directory, under ../Media.  I prefer the manual approach, and it is done using the "Terminal>" icon on the iPad, using "su" to start "root", and then manually running "dpkg".  If you copied the dospad.deb file into directory /var/root/Media, then you should be able to run these steps in a "Terminal" window on the iPAd:

    su [ENTER]
    alpine [ENTER]  <or whatever the root password now is, since you should have changed it!
    dpkg -i /var/root/Media/dospad.deb [ENTER]

Here is a tutorial about installation of ".DEB" files on a jailbroken iPad.

The final step is to use "scp" to copy over your sAPL directory, with sub-directories, from your Windows box.  Before you do that, it is a good idea to create the sAPL directory on the iPad.  Do that using the Terminal application, which you can you can get from the Cydia application.  Cydia is used to download open-source software for the jailbroken iPad.   On the iPad, click on the Cydia icon, and search for and download the "Terminal" utility.  It lets you start a terminal session on the iPad, and create a directory for sAPL in /var/mobile/Documents.  Just: 1) Start terminal 2) cd /var/mobile/Documents  3) mkdir SAPL.  Check the empty directory is there, and in the right location, with "ls -l".  From any directory, you can enter "pwd", which is a unix utility to "print working directory", which shows you what directory you are in.    If you "ls -l /var/mobile/Documents", you should see a blue coloured filename called SAPL.  (We will be using DOSpad, which is case-insensitive). 

Now, you can run an "scp" from your Windows box, to the iPad.  If you have an sAPL directory on your Windows P/C, you can migrate the entire directory, with subdirs, from the Windows box to the iPad, with a single "scp" command. 

Eg:  c:\> scp -r \aplstuff\sAPL  mobile@

The above command copies the sAPL directory from Windows directory C:\aplstuff\sAPL to the /var/mobile/Documents/SAPL directory on the iPad.

To run sAPL on the iPad, click the DOSpad icon, and when the "C:\>" appears, simply enter "CD SAPL", which takes you the SAPL directory.  From there, just enter APL (which starts a small batch file, to set up the font, etc.).  You can exit sAPL and return to DOSpad "C:\>" prompt with ")off".  The APL characters, in sAPL can be accessed using an ALT-key sequence from the displayed DOSpad keyboard.  If you use the sAPL on the iPad in landscape mode, you can have full access to the DOS-based screen.  (Try turning it to portrait-mode, and see what you get then... Some artist worked pretty hard to create an image - complete with a yellow sticky Post-it note - of an old 80386 based P/C!).

"Where can I get sAPL?"  Of course, a critical question.  I have a "" file which is the full sAPL package, including fonts.   The total available workspace size is 312,722 bytes, a very tiny workspace, (you get the size using []WA (quad-WA) function, in a clear workspace), but sAPL is fully free and when I purchased my copy, direct from IP Sharp's head office in Toronto many years ago, it came with a licence that not only allowed me to make copies and share it, but in fact explicitly encouraged this.

I have put a full copy of sAPL up on Github, available as the "" file, which can be downloaded and installed to any subdirectory on any DOS-enabled device, including most versions and flavours of Windows.  Just go to the Gemesys_repository on Github, and click the "Download ZIP" button to get it.  The whole thing is tiny, and contains a collection of sample experimental workspaces in the "apldata" subdirectory.  If you have Windows-XP/SP3 or above, you can just copy the "" file into an empty subdirectory, and use file explorer to extract all the files into that directory.  Once the zip extract is done, go to a command shell (find Cmd shell in C:\windows\system32\cmd.exe, on old Windows-XP/SP3 machines, or use Powershell on newer Windows versions), and run APL from the C:\> prompt.    Here is direct link to the Github Gemesys_repository:

Get sAPL here:

Hope this is useful for some of the APL experimenters out there...

Happy array bashing!  😎

This is an image I found, from Paul Friedl, of the first real personal computer - the IBM SCAMP (Special Computer, APL Machine Portable), circa 1973. I bought my generation-1 Apple iPad in 2010, fully intending to put a working APL on it, one way or the other. Thank-you "redsn0w", for your jailbreak, and to Chaoji Li in China, who did the first DOSbox port to iPad. And thank-you "Saurik", aka Jay Freeman, for his Cydia project, and to everyone who contributed to making the iPad actually work as a proper computer, instead of the child's toy Apple seems to have wanted it to be. Fine work, guys. - Mark Langdon, GEMESYS Ltd.