I adore languages with a high thinking-to-googling ratio. I've been typing the code in this example. Even though I use my mouse to type APL characters, it feels fast. Really, really enjoyable.
A few years back, I ran into two professional APL developers. Apparently there are still 3 major commercial APL vendors (not counting IBM, which probably still sells APL2). Each targeting their own niche, and each being expensive if you're used to free compilers (starting on the order of $1k per seat).
A language that shares the same philosophy but is a little more approachable is J (jsoftware). Unlike APL, it only uses normal ascci punctuation marks. J is also open source, which is a big advantage over APL.
As for J's cousin K, the official K interpreters are commercial (with a free workspace-limited demo version for tinkering), but there is also an actively maintained open-source implementation called Kona: https://github.com/kevinlawler/kona
I think K is a bit more pleasant to read than J because it relies far less on digraphs, but naturally it's a matter of taste.
Yup, GnuAPL is getting better every time I use it for anything. Dyalog for personal use is also very good and decently affordable (and they just released a Mac version, I got to test the beta as an interested user and it works very nicely)
APL is an awesome language with one glaring flaw. It's impossible to read and you need a special input method to type. I enjoy reading about it but I can't imagine I'd ever enjoy having to work with it.
YMMV, but I find the readability of J and K to be far worse precisely because of the ASCII charset instead of the glyphs. The APL glyphs give me a concrete context switching mechanism that I'm operating within its "alphabet" and the semantics thereof. Whereas because I associate ASCII characters with plenty of other meanings already, I find J and K to look like complete line noise in comparison.
Would have to be a one to many relationship. Part of the problem with K is that the meaning of an operator depends on the type of the operands. "?" can be "generate a random number" or "search for an element in a list" for instance. And yes, that is insane.
Or numpy, which from what I can tell is basically a readable version of J. As a concrete example, I've gotten partway through translating the APL examples in "Notation as a Tool of Thought" (http://www.jsoftware.com/papers/tot.htm) into numpy, and they work pretty much unchanged.
If anyone knows APL/J/K well, and could show some programs where idiomatic APL/J/K does not directly translate into idiomatic numpy, I'd love to see them.
Can you suggest a simple program for which idiomatic J differs significantly from idiomatic python/numpy? As I said, I've been unable to come up with one, or find one in aforementioned paper.
I cant speak for J but this is the first APL program I ever wrote (it's in Dyalog) it take a wolfram code on it's right and an array of 1s and 0s on the left and returns the next generation for that one dimensional automaton (it treats the world as wrapping but it would be easy to clamp the sides to 1 or 0):
as a traditional function with comments and stuff its:
NG←R ODAT S;N;P;PS
⍝ First construct the eight *P*ossible states:
⍝ Creates an array 7 6 5 4 3 2 1 0 (⌽0,⍳7) and converts to binary (2 2 2⊤)
⍝ 1 1 1 1 0 0 0 0
⍝ 1 1 0 0 1 1 0 0
⍝ 1 0 1 0 1 0 1 0
⍝ Then encloses along vertical axis (⊂[1])
P←⊂[1]2 2 2⊤⌽0,⍳7
⍝ Convert the *R*ule from wolfram number to binary ((8⍴2)⊤R)
⍝ 110 becomes 0 1 1 0 1 1 1 0
⍝ Then choose *P*ropogating *S*tates (/P)
PS←((8⍴2)⊤R)/P
⍝ Take *S*tate and triplicates ((3,⍴S)⍴S) and rotates (¯1 0 1⌽) to create a matrix
⍝ each colume is a cell and it's *N*eighbors
⍝ A state 1 0 1 1 0 0 becomes:
⍝ 0 1 1 0 0 1
⍝ 1 0 1 1 0 0
⍝ 0 1 1 0 1 0
⍝ Then encloses vertically again
N←⊂[1]¯1 0 1⌽(3,⍴S)⍴S
⍝ Now we have two arrays:
⍝ *N* which is the current generation of state/neighbor triplets
⍝ *PS* which is the triplets that produce a live cell in the *N*ext *G*eneration.
⍝ we create a new array by testing for membership (∊) of current generation
⍝ and *P*ropogating *S*tates
NG ← N∊PS
Some of that might be idiomatic python but the thing is I didn't write it as the multi-line function. I wrote it by modifying the one line function. Which I did because that's how APL's data-flowy syntax/semantics encourages you write things and doing that in one line sure as hell isn't idiomatic python.
The determined programmer can write any language in any language. It's what we write when we aren't being determined fortran/smalltalk/whatever programmers that speaks to the difference in programming languages.
It's certainly esoteric, but I wouldn't say it's unreadable. Given that APL is like a programming alphabet of sorts, it'd be interesting to see how quickly and tersely one could put together infrastructure with it. Too bad it has virtually no ecosystem.
Readable, understandable even (with a lot of "I bet this symbol does this"), but not writable.
It may not be a meaningful comparison, but the commenting on the side is more reminiscent of assembly than a high-level language (i.e. the code itself is not sufficient to tell you what it's attempting to do). Is this how well-commented most APL turns out, or is this due to being a teaching piece of sorts?
I have a secondary keyboard input method on my Mac for when I'm in APL mode. It just remaps my keyboard, and once I got used to it I know where most commands are (the basics, sure, some I have used less are harder to come by but I'm getting there slowly.) It's kind of learning vim or emacs: once you get the bindings you just forget about them and know by feel.
The terseness is because it was originally developed to be written on a blackboard while lecturing.
As CS developed in the math world Iverson realized that the existing math was crap for describing computational processes. So he made his own and as it turned out it, with a little modification it was executable.
- Philip Greenspun
From http://www.paulgraham.com/quotes.html
I adore languages with a high thinking-to-googling ratio. I've been typing the code in this example. Even though I use my mouse to type APL characters, it feels fast. Really, really enjoyable.
Thanks to the author; this is readable and fun.