What I mean by "readable" is, that it uses ASCII strings and actual names, not merely 1 character (except for very few cases where 1 character might be appropriate, like "Y" or stuff like that) as function names, instead of symbols, of which I do not know their names. I should be able to not only write once, but read again easily. I should not need a special keyboard or special keyboard layout to write programs in the language.
I urge you to reconsider: That they are 1-character is an extremely important feature of Iverson's work.
> instead of symbols, of which I do not know their names
Why do we write 5+5 and not five plus five? The symbols are important! Gosh, can you even remember not knowing how to do addition? Don't you remember how much easier adding things up became once you learned "+"?
Most of Iverson's ideas for symbols really good -- so good that if you do learn their names and everything about them you will have the most amazing ideas as significant a change in you as learning "+"
> I should not need a special keyboard or special keyboard layout to write programs in the language.
You don't need anything of the sort, but if you can't touch-type in APL you might want keycaps, because I think connecting the idea with a single symbol or unique idea is harder if you keep having to translate to English all the time.
Because tradition is a very hard stuff to get rid of. Just like clocks with needles, with 12 sections.
If you assume addition as implicit juxtaposition syntactic operator ⁙⁙ or ⬠⬠ is also damn efficient to represent five plus five (/faɪv.plʌs.faɪv/ in IPA).
In Ruby:
class Fixnum alias_method :plus, :+;end
five=5
five.plus five
Multiple letter "five" is a single symbol, just as the multiple pixel 5 glyph.Now, there is some convenience in having scripturally short symbols when you do your math with paper and pencil, for example posing some additions in column. But that’s all there is to it, pencil convenience.
A concept is a single semantic idea whatever the length of the symbol used to refer to that concept.
Once you overcome the admittedly very steep learning curve of APL, it tends to actually be more readable than Algol-likes in many respects.
In fact, counter-intuitively, the single-character symbols actually contribute a lot to its readability. This is, in part, similar to the reason that "a^2 + b^2 = c^2" is usually preferred over "The sum of the squares of the orthogonal sides of a right triangle is commensurate with the square of the hypotenuse," assuming you've done your homework and know basic algebra, equational reasoning, and all that.
In my experience, I see something like a 100X reduction in code size. This means that on my editor screen, right now, just by moving my eyeballs, I can read code that would be scattered over 10s of files in Python. This is the stronger sense in which APL is more readable, and by a large margin, to boot.
Seriously, APL is tons of fun. I feel like it would be tragic to let a few small preconceptions cut off the potential for you to give it an honest go. Also, the J and APL communities are each quite distinctive. FWIW, I've have a particularly good experience with the people using Dyalog APL.
These two expression doesn’t carry the same level of information. At best the first, without additional contextual information can only be interpreted as into "The surface of two square equals to a third", or more directely "a·squared plus b·squared gives c·squared".
Also, nothing keeps you from implementing names functions in k or j out of the 1 letter ones;
3#!9 / original
0 1 2
take:{x#y} / or take:#
take[3;!9] / 1 readable function
0 1 2
range:{!x} / or range:!:
take[3;range[9]] / all readable functions
0 1 2
take[3] range[9]
0 1 2
In k. You can make a readable lib, but I wouldn’t.Documentation: https://pkg.go.dev/robpike.io/ivy#pkg-overview
Also see these Advent of Code 2021 solutions with Ivy: https://www.youtube.com/playlist?list=PLrwpzH1_9ufMLOB6BAdzO...
The insight underlying APL is that this idea can be extended further. When working with matrices (2d arrays), the operations of (a) checking the shape of an array and (b) reshaping arrays are so frequent that APL designates a single symbol for them: "⍴" (which to me looks like an iron bar whose end was "reshaped" into a loop).
In the same way as "-", compact symbols aid communication and also comprehension. Since the symbols aren't alphanumeric, whitespace separators aren't necessary to delimit tokens. Just as "10-7" means the same thing as "10 - 7", "3⍴4" and "3 ⍴ 4" are equivalent (it means a 1d array comprising 3 fours: 4 4 4).
What has helped me has been learning from the inventor himself: Iverson wrote books that introduced the symbols in a very natural way. The one I'm working through now (and which I highly recommend) is "Elementary Algebra", available for free download here:
https://www.softwarepreservation.org/projects/apl/Papers/Ele...
To try out your own expressions, you can use https://tryapl.org/
I keep eyeballing that thing. But I am afraid that like only 7 people use it and it isn't a good longterm investment. No idea.
BQN is, in my opinion, the most slick of the array languages; it consistently takes the best of the approaches to high-rank arrays and combinator (including tacit) programming from the others. Some things are unique, and amazing, like structural under.
It is small, it is new, so I would agree with your hesitation to start a business based on it, but to understand these languages or use it for the typical small calculations, it is more than capable.
k is a bit like APL, but more concerned with lists rather than multi-dimensional arrays. It uses normal symbols that are easily accessible on your keyboard like + and !, but they are seriously overloaded.
q is built on top of k, and take all the monadic overloads of the operators and gives them a name.
So instead of writing
!5
to get a list of the first 5 integers, you write til 5
This is sort of what the original comment is getting at (I think)Futhark: https://futhark-lang.org/
It definitely doesn't; J is ASCII symbols. See the vocabulary at https://code.jsoftware.com/wiki/NuVoc - those things in the coloured boxes like ": and ;. and {: are the J building blocks and the quotes and brackets don't pair up. If you want words and "actual names", you need something else.
Dyalog APL is more of an actual APL, https://www.dyalog.com/
There is also J https://www.jsoftware.com/#/
The array language community on discord "The Apl Farm" (https://discord.gg/SDTW36EhWF) is pretty active.
I also love the Arraycast podcast https://www.arraycast.com/ many amazing interviews and interesting discussions.
I've been using klong as it is small, quick to build and has good intro, reference and quick-reference.
One downside is somewhat memory limited.
If I recall correctly, the Dyalog branch of APL allows for variable names? I kind of like the idea of zero variable names and all strange symbols. The reasoning that after you learn those, you can read any program and understand what's going on at every step, without needing to check what each function actually does -- that sounded very intriguing to me.
And the reason that "checks out" (or may) I guess is that the language's primitives are very carefully chosen such that you have a kind of extreme economy of "words" - so your LOCs will be so low such that you may not need to abstract lines into mysterious function names to reduce the number of lines a person has to read to understand what a program does. Aka the economy of words more than compensates for the lack of abstraction.
A few decades ago, j (an apl dialect) innovated a form of tacit programming—programming functions which do not refer to their arguments by name, and which do not need to name intermediate terms to share them—but you still must name your functions if you would like to compose them or if you would like to avoid the extremely-long-line problem.
Generally, I write J programs using a mix of small, tacit functions, and larger explicit functions. The latter primarily comprise a sequence of assignments, and generally use unnamed tacit functions heavily (alongside explicit applications and references to other defined functions) when constructing intermediate terms. Explicit control flow is rare, but usually accomplished using builtin combinators and recursion when necessary.
I agree maybe a little bit of variable and function naming is fine in some cases.
There is a concept of tacit, or point-free, programming, which avoids the variable names as parameters, for example the calculation of the mean `avg ← +⌿÷≢`. However this does become unwieldy pretty quickly, and it's easy to juggle too much. It is very useful for short snippets, where you avoid all of the ceremony and can just express the core thing you want to talk about (for the avg example, it's not improved by including a parameter: `{(+⌿ ⍵)÷≢⍵}` - the ⍵ parameter isn't informative at all, and nor would anything else, like `samples`). I think it is best to keep the tacit snippets short, and to assign good names to them.
However, given the aesthetic that you express, I think you might like https://github.com/Co-dfns/Co-dfns/. This is hands-down my favorite kind of APL, in which the data flow literally follows the linear code flow.
Also, Matlab's treatment of arrays is derived directly from APL.
Also when I tried SSE and AltiVec about 20 years ago for SIMD, they were really fast, but I was flabbergasted that the instructions were fixed-length. I wanted something more like the x86 string instructions so that I could fused-multiply-add arrays of floats without having to manually unroll loops to process 4 elements at a time:
https://docs.oracle.com/cd/E19120-01/open.solaris/817-5477/e...
Looks like Arm is trying to do variable-length vectors with Scalable Vector Extension (SVE) but it's limited to 2048 bits, which is unfortunate IMHO:
https://developer.arm.com/documentation/101726/0400/Learn-ab...
https://alastairreid.github.io/papers/sve-ieee-micro-2017.pd...
Matlab was created for people too dumb to use Fortran. APL was invented for people too smart to use Fortran.
Tldr: Fortran, C/C++, Matlab, Python, Julia are all great and serve different roles with pros and cons.
APL seems beautiful to me and would probably help me with a number of tasks I do but it doesn't feel easy to actually practice.
I have been interested in APL and friends for some time, but have not yet seen an example which made me commit to taking the time to learn it. numpy (and JAX) have been doing everything I wanted, so far.
> i don't know one week of studying some APL i could just visualize how I would do that and I would just run and no error every time. Like one week of study APL did more for my expertise, you know, by then more than one year coding in JAX and NumPy.
João Araújo in The Array Cast: https://www.arraycast.com/episodes/episode33-joao-araujo
I really enjoyed creating clever combinations of the APL operators to get a ton of computation done in one line of code. However, this was the epitome of "read-only code". It was very difficult to read that kind of code after writing it.
After college I never used APL again, although I worked as a software developer (and still do). I miss the fun I had with it, but I wouldn't want to use it for code that I or anyone else would have to maintain, and I doubt that it would be a very expressive language for most commercial applications. For mathematical, array-oriented tasks, Python has appropriate libraries that would probably lead to more maintainable code. And of course there's Julia.
But I can imagine some people still having the expertise to use APL for exploratory calculations, enjoyably and more productively than any other language.
I tough an array is "just a column" and somewhere I get to K and that leads me to my current attempt to build a language that make both paradigms work: https://tablam.org
I think each paradigm complement and "fill" the mission pieces the other has. For example, you can name columns, that is alone very useful!
BTW kdb+ is also on this direction but the combination is `array then SQL/Relational` and mine is `Relational then Array`.
I dabble with BQN and Klong.
Anybody here write a working solution to that problem? Or remember it, even?