APL & Array programming

Here’s a fun little APL example!

3 Likes

Curious why APL over J, given what you’ve previously said about J and the extra symbols etc in APL?

2 Likes

Works fine for me. It links through to the latest version as listed on the Dyalog and it’s grabbing their binary.

The homebrew binary doesn’t seem to come with the RISE IDE. I couldn’t figure out how to get it to work / connect it + install the RISE package separately etc so that they worked together.

I tried just downloading it straight from their website and that comes with Dyalog APL together with the RISE IDE. If you’re using a Mac, I’d recommend just downloading it straight as was suggested above. (i.e. probably don’t use Homebrew to download it).

3 Likes

The APL Wiki is a very nice resource for all things APL.

Looking forward to these sessions as a trip down memory lane. I used APL in the 1980s for life insurance pricing.

4 Likes

Hi Everybody
I thought this thread was really interesting because the thing I love about IT is there is nothing new, just renamed.
I had studied APL at University in the late 1970’s and in the early 1980’s a concept called the Information Centre was invented by IBM, which we implemented in my company. The idea was that managers and users could use computers to assist their decision process. IBM had three APL based packages for the IBM Mainframe. A Department Reporting System ADRS was the reporting component. Jump forward 40 years and here we are discussing using APL for deep learning. One of uses of Deep Learning is helping managers and users to assist their decision processes. I suppose given the parallel processing on the GPU, there is a natural affinity to vector based languages such as APL.
Regards Conwyn

1 Like

I like the extra symbols in APL. Did I previously say I didn’t?

I also prefer how APL handles dyadic trains. There’s some things I like better about J though. My ideal language would use APL’s glpyhs and dyadic trains and J for everything else…

1 Like

To clarify - I’m not sure the study group will look at APL for deep learning.

Not gonna lie, I was hoping we’d see some demo of a toy neural network but it’s all the same, I love obscure programming languages and looking forward to learning a little bit more. Plus I don’t think APL can talk to CUDA natively, but I could be wrong.

Nope, but there is a GPU dialect: GitHub - Co-dfns/Co-dfns: High-performance, Reliable, and Parallel APL

There’s also a J binding to Arrayfire, although no docs I can see (other than some rather concise tutorials): GitHub - jsoftware/math_arrayfire: Arrayfire addon

4 Likes

I think I assumed that somehow, given that J is sometimes sold as “APL, but without all the need to learn dozens of extra symbols”.

In J you just have to learn dozens of digraphs instead. The APL symbols actually have pretty good mnemonics – so far on the whole I haven’t found remembering them particularly challenging (not that I know many yet!)

2 Likes

Yeah I imagine it’s probably the same as learning a new (human) language where often a new alphabet is a huge hump for people.

Installing Dyalog on Debian 11

I’ve logged my steps installing it; hope this helps.

Short story

You may need to install the packages libtinfo5 and dotnet-runtime-3.1 via apt

Log

Downloading the .DEB package file from https://www.dyalog.com/download-zone.htm

sudo dpkg -i linux_64_18.2.45405_unicode.x86_64.deb

If I do dyalog --help however:

/opt/mdyalog/18.2/64/unicode/dyalog: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

ldd /opt/mdyalog/18.2/64/unicode/dyalog indeed confirms: libtinfo.so.5 => not found

locate libtinfo.so.5 returns nothing, but locate libtinfo.so.6 does.

apt search libtinfo shows that major version 5 (legacy) is available. Should be fine to install side by side with 6. Let’s try

libtinfo-dev/stable 6.2+20201114-2 amd64
  transitional package for libncurses-dev

libtinfo5/stable 6.2+20201114-2 amd64
  shared low-level terminfo library (legacy version)

libtinfo6/stable,now 6.2+20201114-2 amd64 [installed]
  shared low-level terminfo library for terminal handling

If I do dyalog --help however:

CLEAR WSIt was not possible to find any compatible framework version                                                                                                                                                      
The framework 'Microsoft.NETCore.App', version '3.1.0' (x64) was not found.
  - The following frameworks were found:
      6.0.6 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=debian.11-x64
Init failed: 0x80008096

If you do not have dotnet already installed https://dotnet.microsoft.com/en-us/download explains how to set up .NET on various platforms including Linux. after that:

sudo apt install dotnet-runtime-3.1

dyalog then starts OK (in TTY mode).

3 Likes

I have only watched a few of tutorials so far, but honestly, I love the symbols and they’re kind of self explanatory once you know the background. I find J’s symbols to be rather distracting and not so aesthetic. From the background on APL that I’ve gleaned, it seems this is a “tool for thought” for experts and it seems to me that Physicists and Mathematicians already either know the greek symbols or they’re quite comfortable with the idea of symbols denoting abstract concepts (to manipulate larger abstractions.)

The only thing that throws me off so far is that I feel there aren’t enough spaces in what I think is referred to as “trains” or string of symbols that build up a given expression. Having everything all together throws me off. As a beginner, I would break down parts of a larger expression into smaller digestible chunks assigned to intermediate names, and then build the larger expression at the end.

2 Likes

Using Dyalog APL in Debian Linux and its Derivatives

by Rito Ghosh

I use Pop OS 22.04 LTS edition. But this tutorial should work with all Debian-based Linux distributions.

Using Dyalog APL in Windows is trivial, but with Linux, there are one or two extra steps.

NOTE: Dyalog APL runs on Linux only on the Terminal (TTY mode).


Step-1: Download the Dyalog APL Set-up File

  • Navigate to the official download page. Then you will have to accept their terms.

  • Then you can either choose to register yourself with Dyalog or download the product unregistered.

  • The free license is good for everything outside of commercial use.

  • Download the .DEB file from the page.


Step-2: Install

  • Install the downloaded DEB file. Either let your package manager handle this via GUI by double clicking or use dpkg. You might need elevated permissions.

Step-3: Install Missing Libraries

It is very likely that you will miss one or two libraries that are required.

You will most likely miss libtinfo.so.5. You can installing it using apt.

sudo apt update && sudo apt install -y libtinfo5

(source)

This will install the missing library.

You might have another missing library dotnet-runtime-3.1. I did not face it. If you do, just installing it via apt will solve this problem. See more: jmp’s post on fast.ai forums.


Step-4: Installing Keyboard Support

APL uses a lot of special characters, "glyph"s. And you need to type them to be able to use APL.

This is trivially easy.

Before you start Dyalog APL, you need to run the following on terminal:

setxkbmap -layout us,apl -variant ,dyalog -option grp:switch

(see explanation here on aplwiki)

This command sets the Right Alt for typing glyphs rather than the Control key.


Now, you are ready to work with APL.

asciicast


I will add new sections if needed. Let me now if you face any problems.

6 Likes

I tried some basic operations in Dyalog APL. However, my results started from 0 instead of 1. Any idea to fix it? (I am using the Windows version) :thinking:

Example: per tips
image

My result:
image

In Learning APL they set it to start from 0 with this command:

⎕IO ← 0

2 Likes

To start from 1:
⎕IO ← 1

1 Like

For all those on Linux, I highly recommend installing RIDE, as it gives a much better (and GUI) IDE than the TTY version, with hover-for-info/click-to-insert language bar, and out-of-the-box keybindings (e.g. `i for ). On macOS, this installs as part of the package.

7 Likes

Just wanted to point out, this is the magical bit! :slight_smile: If you want to get the jupyter kernel running you need this installed!

I was trying to get the kernel to run on WSL, but not a whole lot of luck. I installed dyalog and followed the installation instructions in the apl kernel repo, but was getting weird errors.

Once I installed libtinfo5 it all started to work :slight_smile:

Thx for sharing this @rghosh!

6 Likes