APL is for the intelligent
Why is APL the language of the future, even though it is roughly 50 years old? Why didn’t it take off like C did? To answer this, we need to delve into probability and intelligence.
The problem with probability is that things that seem non-random or planned may actually be random (Tarasov, 1990), whereas things that seem random, may, sometimes be deterministic or an outcome of some emergent state (where the interaction of several elements and factors causes a new state to emerge: for instance, poverty is one such fuzzy emergent state).
However, probability is quite tricky. Even some emergent states may actually be probabilistic or random, or at least some of the factors at play may be decided by randomness. (Again, in some cultural contexts, poverty may be partially stochastic.).
What about intelligence, then? While some elements of intelligence, what may be termed basal (as in, starting from tabula rasa) is partially stochastic (you can’t control how a future adult’s mother behaves during pregnancy: did she consume alcohol? smoke? is she severely nutrient-deficient?), the good news is that increasing one’s intelligence levels is achievable.
As research on FVR shows (Krashen, 1994), reading is one example of how not just language acquisition but general mental competences can be elevated through consistent free voluntary reading (“reading because you want to”). Latest research confirms my long-held hunch that how we think about how we think affects how well we could think:
Mindset theory is an achievement motivation theory
that centers on the concept of the malleability
of abilities. According to mindset theory, students
tend to have either a growth mindset or a fixed mindset
about their intelligence; students with a growth mindset
tend to believe that intelligence is malleable, whereas
students with fixed mindsets tend to believe that
intelligence is unchangeable.
Kapasi & Pei, 2021
One of the harms caused by the racist IQ theory (whose foundation rests on Darwinism) is that, in the garb of science, it promotes the idea that intelligence levels are hereditarily determined and there’s not much you can do about it. It is safe to assume this could be why many people function with a fixed mindset: they have accepted the fake science of the supremacist Darwinists, and they have given up the Kantian courage to ask why.
In the meantime, failure to have superior outcomes is attributed to a fixed low or average IQ value, whereas, in actual fact, the culprit is the mindset:
As described in many empirical and theoretical papers, the mindset a student holds can influence important psychological and behavioral factors, including reaction to failure, persistence and level of effort, and expectations of success, which ultimately impact academic achievement.
Kapasi & Pei, 2021
Interestingly, a large body of research (Kapasi & Pei, 2021) now supports the claim that mindsets can be changed and with it, mental performance. But that’s not the issue. The problem is, in a given slice of time, what percentage of population is operating on fixed mindset? How many people have even heard of the mindset-change theories and the hope that basal intelligence can be elevated through proper methods (among them, chief: deliberate practice and FVR)?
A simple and quick investigation can easily show that generally speaking, intelligence levels are normally distributed (most people have average “IQ”, minority percentages are either below average, or above average). Per this, if majority of the populace is operating on fixed mindset, it is natural to conclude that:
-
Mediocre-quality tools will dominate the work landscape.
-
Superior-quality tools will be either ignored, or underutilized.
APL is one such tool that has been ignored or underutilized. A small percentage of very intelligent people are ensuring it remains alive and program in it. The rest will be happy with Java. :)
But I am assuming you are still here, reading my long essay because the concept of intelligence appeals to you, or at least, you are curious about what I have to say with regard to APL. Eitherway, although Ruby is dear to my heart (another underutilized gem of a language!) it is not even in the same neighborhood as APL!
Let’s show a few demonstrations of the power of APL and how the same is done in Ruby (which, by the by, is better than most languages out there).
Let’s say you have two int arrays [1, 2, 3] and [4, 5, 6] and you want to add them element-wise, like so:
a, b = [*1..2], [*4..6]
a.zip(b).map {|x, y| x + y}
##==> [5, 7, 9]
And in APL? As simple as a dyadic addition!:
1 2 3 + 4 5 6
⍝⍝==> 5 7 9
Or let’s create a 2 x 3 matrix in Ruby and then reverse each row:
mat = [[*1..3],[*4..6]]
##=> [[1, 2, 3], [4, 5, 6]]
Note that running the intuitive-sounding .reverse!
will result in reversing the order each row appears:
mat.reverse!
##==> [[4, 5, 6], [1, 2, 3]]
Whereas what we want is:
mat.map(&:reverse!)
## ==> [[3, 2, 1], [6, 5, 4]]
In APL, doing this is trivial:
mat ← 2 3 ⍴ ⍳6
⍝⍝==> mat
⍝⍝==> 1 2 3
⍝⍝==> 4 5 6
⌽ mat
⍝⍝==> 3 2 1
⍝⍝==> 6 5 4
So basically, 2 3 ⍴
is two-three-rho, meaning create a 2 x 3 dimension something, and iota-6 ⍳6
means list all the numbers from 1 to 6 inclusive. This ‘something’ created by iota-6 is then transformed by rho, into the 2 x 3 matrix. The ’trams’ ⌽
reverses the matrix. Easy peasy!
Or let’s see this:
[1, 10, 100].map{ |x| x * 3}
## ==> [3, 30, 100]
Which, in APL, is simply:
3 × 1 10 100
⍝⍝==> 3 30 300
Careful though as you can see:
1 10 100 * 3
⍝⍝==> 1 1000 1000000
Likewise, if we were to:
(1..(2 + 5)).map {|x| x * 10}
## ==> [10, 20, 30, 40, 50, 60, 70]
We’re essentially saying, from 1 to (2 + 5) or 7 times, multiply each value in that range by 10. In APL? ell:
10×(⍳(2+5))
⍝⍝==> 10 20 30 40 50 60 70
Now that you’re familiar with some basic APL notation, you see it’s not so intimidating anymore. In fact, it’s just like a foreign language you just learned.
APL is the language for the intelligent, thinking programmer.
References
Kapasi, A., & Pei, J. (2021). Mindset theory and school psychology. Canadian Journal of School Psychology, 37(1), 57–74. https://doi.org/10.1177/08295735211053961
Krashen, S. (1994). The Power of Reading: Insights from the Research. The Modern Language Journal, 78(3), 407. https://doi.org/10.2307/330145
Tarasov, L. V. (1990). The world is built on probability. http://ci.nii.ac.jp/ncid/BA07136401