Hacker News new | ask | show | jobs
by chrispsn 1493 days ago
In case you've jumped straight to the comments, here are some intro links. Many of these also appear in ngn/k's readme.

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...