Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

APL/K's expressiveness does not come from making every operation a single character (although they do work together nicely).

It comes from selecting a good set of primitive elements and their rules of interaction. It turns out (for K) that ~40 primitives are sufficient to cover what you need, and it is therefore possibly to assign these to single ascii characters (20 unary, 20 binary; e.g. "xy" is multiplication, but "x" is "first element of x". Most languages overload unary/binary on the same symbol).

Take, for example, the "maximum substring sum" problem (see link in the K idioms above). Using K syntax, it's

    |/0(0|+)\
Using Q syntax (K with words instead of characters), it becomes

    max over 0 (0 max +) scan
Three times longer, hardly using any non-alphabet characters. Just as unreadable to the uninitiated, and still 10 times shorter than a comparable Python or ruby implementation.

Once you do get used to thinking in APLish or Kish, then the first version to the second version is like "a+b*c-d" to "a added to b times c and then d is subtracted". I know which one I prefer.

Short isn't equal to expressive, but your comment is irrelevant to APL or K.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: