chrispsn
Notice that aside from reverse (monadic |), all verb symbols in the above code are in most other languages (max as |, min as &, plus as +, minus as -). Adverbs (such as / for reduce and \ for scan-reduce) make the symbols we already have more generally applicable.
I think a language could go a long way with a small set of basic arithmetic symbols alongside a rich set of adverb symbols.
K: Default Dicts?
https://gist.github.com/chrispsn/da00835bb122c42f429a084df83...
The kparc.com links are down though.
Show HN: REPL.club – client-side interpreters in the browser
K: Default Dicts?
https://ngn.codeberg.page/k/#eJxdjssKwjAQRffzFddVFyLFoiiFQD8...
Group tells you the places each element occurs in a list. It generates lists of indices.
K: We need to talk about group
(Π):!/: / make table
Π[`a `b
( 1 2
3 4)]First, direct links to ngn/k in the browser:
- REPL: https://ngn.bitbucket.io/k/#r
- Editor: https://ngn.bitbucket.io/k/
Second, the best one-stop shop for an overview of k6's primitives (both ngn/k and oK are based on k6). https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual....
The best intro examples are in John Earnest's k editor iKe - there's a dropdown at the bottom right. http://johnearnest.github.io/ok/ike/ike.html
ngn/k's editor also has an 'examples' dropdown in its menu.
For an illustration of k's strengths, Razetime's matmul refactoring is brilliant: https://github.com/razetime/ngn-k-tutorial/blob/main/c-think...
Finally, some nice examples of concise k:
{$[2>#?x;x;,/o'x@&'~:\x<*1?x]} / Quicksort
(+':,)\~!10 / Pascal's triangle
{x x}{x{x[x]y}y} / Y-combinator
Executable versions of above:- Quicksort (via Kelas's KCC guide): https://ngn.bitbucket.io/k/#eJwrLLaqVok2slO2r7CusNbRz1evcFBT...
- Pascal (via Richie/Attila): https://ngn.bitbucket.io/k/#eJzT0Fa30tGMqVM0NAAADYMCZg==
- Y-combinator (via ngn): https://ngn.bitbucket.io/k/#eJyLtKquUKiora6oroiuiK2srax14IqM...
K or LINQ?
What is a primitive?
Learning APL
Yep. For this reason deep where ideally wouldn't live on '&'. It should be able to absorb any structure for subsequent use with deep indexing etc, regardless of rank. Perhaps another reason to make 'explode' an adverb...?
K: War on Raze
K: War on Raze
BQN: Implementation of ordering functions
Benefits of 2D code layouts (2018)
The Aarne–Thompson–Uther Index
Commercial k variants come with a columnar data store (see Kx's q/kdb+, Shakti's k9).