Back

Golfing APL/K in 90 Lines of Python

56 points5 daysaljamal.substack.com
pjmlp4 hours ago

The original Lisp in 1958 had only lists, by the 1970's many implementations already had all other key datastructures like arrays and hashes.

forgotpwd163 hours ago

Partially reminds me (due to _V,_f,_F,f,F) Whitney's ksimple implementation[1].

[1]: https://github.com/kparc/ksimple/tree/main/ref#ac

heliumtera3 hours ago

I strongly dislike this choice of using all the symbols that do not exist on normal keyboards. I can't stand this, seems very attention seeking. Why not choose normal thingies that can be typed using the main interface we have with computers? This makes me mad, even.

But programs written in K are so beautiful and terse they are unlike anything else I've seen. It feels like there is something about it we can't really comprehend, like this beauty could not be achieve by accident, like there is something fundamentally right there...like there is some fundamental truth here. And maybe this is true about APL also.

jasonwatkinspdx3 hours ago

APL predates ASCII by a couple years.

It originally wasn't even intended as a software language, but rather a uniform mathematical notation in the style of curry's combinators, but more practical for describing non trivial algorithms.

So he was in an era where the expectation was if you were typesetting a mathematical monograph you'd already be doing stuff like swapping the balls on your IBM typewriter for math symbols.

It's not a choice you'd make today obviously, but it was entirely reasonable then.

As for why it persists, simple answer is APL fans like it that way. It's trivial to translate to some ascii text representation. I think anyone strongly motivated to do that just switched to j, k, or if even those are two weird goes to numpy or such.

ofalkaed2 hours ago

>It's not a choice you'd make today obviously, but it was entirely reasonable then.

More recently, BQN made this same choice and I think it is perfectly reasonable to do as long as you have a reason beyond simple aesthetics. Entering these symbols on a normal keyboard is not difficult and no different from learning a human language which uses a different alphabet than you keyboard.

Personally I find the custom symbols of APL and BQN to be easier to type and read than the ASCII of J and K.

heliumtera3 hours ago

>So he was in an era where the expectation was if you were typesetting a mathematical monograph you'd already be doing stuff like swapping the balls on your IBM typewriter for math symbols.

makes sense, maybe that would be more ergonomic to type for the public it targeted, indeed.

i won`t deny it is a stupid take of mine, but it makes me mad. i get the same feeling reading mathematical notations, so there is that.

alt1872 hours ago

To be fair, even after reading the other guy's post, I'm still mad about it. They even sell APL keyboards now. The indignity.

KK7NIL3 hours ago

> Why not choose normal thingies that can be typed using the main interface we have with computers?

Iverson answered this in his Turing Award acceptance lecture, which is literally linked in OP's article: https://www.eecg.utoronto.ca/~jzhu/csc326/readings/iverson.p...

You're free to disagree with him, but you need not wonder why!

heliumtera3 hours ago

thanks for the reference, appreciated