4 ms·
Short isn't equal to expressive. Making every operation a single character does not really help understandability, IMO.
by skrebbel 15y ago
Short isn't equal to expressive. Making every operation a single character does not really help understandability, IMO.
- beagle3 15y agoAPL/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.
- hvs 15y agoThe APL-family of languages aren't just short. Those single (and double) characters are each very powerful. APL was not based on the von Neumann style of programming. It is much more comparable to Haskell and the like.
- deleted 15y ago[deleted]