336 karma · joined October 26, 2015
Most problems are also much simpler, and don't require any heavy one-liners.
The other powerful notion is that arrays become mapping functions over their index.
The k7/shakti tutorial playfully notes that running one's finger along the shifted top row of the keyboard is syntactically valid.
C-h f
And then I type sort of what I want (with helm or ivy, it's a fuzzy match) and select it from the list, which brings up it's documentation and what keystrokes call it.
There is also `where-is` if you remember the name, or `M-x` (or `M-:`) if you don't mind typing it out.
x: 10 ? `a`b`c
x
`a`c`c`c`c`a`b`a`a`c
=x
a|0 5 7 8
b|,6
c|1 2 3 4 9Most code isn't clever oneliners, and is quite readable.
There are open source implementations of some K versions - Kona, which is K3, and oK, which is ~K5.
J is available under GPL3.
Not tried multiplayer, but it's hard to make that worse.
Also never worked out how to mod things, but if you're just after the vanilla experience, it's very good.
The second incompleteness theorem gives an example of something undecidable that's probably more interesting that the uselessly paradoxical statement in the first: it says that no system can consistently prove its own consistency.
In a semantic sense, the key idea is that you compose operations on array indices. A good example of this is k's where operator, &, which converts an array of booleans into an array of indices where it is true. It's very common to take & of some predicate on your inputs, manipulate that for a while, and then index into something else at the end.
There are also ideas of rank/shape ambivalence, which naturally encompasses broadcasting (so scalar + vector broadcasts the scalar, vector + matrix broadcasts the vector row-wise, etc).
You certainly can implement something with APL's semantics as a library - Numpy does this. The magic of using APL comes from having all these features at once.
Otherwise there's ipc clients, and a very nice native python integration now.
Writing a programming language in APL is not for the faint of heart - co-dfns is, alongside it's performance goals, to show that compilers aren't necessarily a bad fit for APL.
Breaking stuff down costs, as well - you have to make it clear how something is going to be used. You might write a helper function for one bit in particular, and then rely on additional levels of abstraction to make it clear how this function should be used.
Instead, if you can allow your functions to become semantically larger, you don't need to explain and protect your modularisation. Helper functions with one use are inlined (it's very common that these things have names longer than their definition). Instead of a large tower of abstraction, you just have two levels: the level of the data, and the level of the problem. Your entire program is written as functions, each of which does something in the problem domain, and for each, each definition is immediately clear about what it is doing with the data.
There was an article here, a while ago, called 'smaller code, better code', and with accompanying comments, that explain this better than I can.
Alternatively, there's the free and open source Kona, which is an implementation of K3, the preceding version.
Is this this absurd? Given you can compile WASM whilst streaming, you should really precompile your JS into WASM if you can.
An example would be 3-SAT, which takes a boolean predicate of a particular form (that it is conjunctions of disjunctions of 3 variables), and then an assignment of the variables, and checks if it satisfies the predicate. You can do this in polynomial time, so 3-SAT is in NP.
They show that you can generalise them and build levels that are NP-hard: for example, in the case of Pokemon, they build systems requiring that the player have a specific team (one that is very unlikely to ever actually be used).