3 ms·
You (and Ola ...) really should take a look at the APL / J / K family. All are 10-100x times more expressive than Ruby/Python, and 100x-1000x times more express
by beagle3 15y ago
You (and Ola ...) really should take a look at the APL / J / K family. All are 10-100x times more expressive than Ruby/Python, and 100x-1000x times more expressive than C and Java.
They are all quite fast, with K being super-blazing-fast.
I can't do these languages justice in a comment -- but have a look at https://github.com/kevinlawler/kona/wiki/Idioms https://github.com/kevinlawler/kona/wiki/Idioms and https://github.com/kevinlawler/kona/wiki https://github.com/kevinlawler/kona/wiki - you are in for a shock about how unexpressive everything you've used so far is (and you don't have to give up speed to get that)
- skrebbel 15y agoShort 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]
- chubot 15y agoBut aren't these just domain-specific languages? It doesn't make sense to compare them to Ruby/Python or C/Java, because they don't solve the same problem. It's like saying that sed is more expressive than C. Can you write a web server or a source control system in APL/J/K? I don't think so. You can compare Python and C because you can write a source control system in both (e.g. Mercurial and git).
- beagle3 15y ago> But aren't these just domain-specific languages? No. Why would you think that? > Can you write a web server or a source control system in APL/J/K? Yes. I'm not aware of a source control system written in any of them, but K's standard web server is implemented in K; there are several databases written in each of them - flipdb in APL, kdb+ in K, JDB in J. There are compilers written in each. There are raytracers, spreadsheets and sudoku solvers. http://nsl.com/ http://nsl.com/ contains a lot of K examples, some of them annotated. jsoftware.com is your source for J examples.