4 ms·
A lot of the ideas in APL were eventually transplanted to J [1] and K. K was eventually subsumed by Q [2]. (There's an open-source clone of K called Kona [3].)
by chrisaycock 16y ago
A lot of the ideas in APL were eventually transplanted to J [1] and K. K was eventually subsumed by Q [2]. (There's an open-source clone of K called Kona [3].)
The common "hello world" app of APL-derivatives is sudoku. Here's a an example, using K [4]:
p,:3/:_(p:9\:!81)%3
s:{*(,x)(,/{@[x;y;:;]'&21=x[&|/p[;y]=p]?!10}')/&~x}
Terse, right?
In addition to the productivity gains from not using loops, array programming has performance benefits since memory management tends to be more efficient, from a compiler optimization standpoint. That's because everything is stored contiguously and operations are mapped to cache-effiencent iterations. In addition, some implementations can take advantage of vector processing (SSE, etc.) quite easily, since the programmer expresses all actions at the array level.
[1] http://www.jsoftware.com/ http://www.jsoftware.com/
[2] http://kx.com/Developers/software.php http://kx.com/Developers/software.php
[3] https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona
[4] http://thesweeheng.wordpress.com/2008/11/30/more-sudoku-solvers-in-k-and-q/ http://thesweeheng.wordpress.com/2008/11/30/more-sudoku-solv...