News for hackers. Stuff that matters.

chrispsn

Click on k, then k.zip.
Re:Learning K programming: idiom by idiom [pdf] on Sunday May 12, 2024 @08:52PM (#40338777)
Adding to RodgerTheGreat's comment: for me, k's power is its rich set of adverbs that are convenient to write.

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.

Re:Array Languages vs. the Curse of the Spreadsheet on Wednesday March 06, 2024 @06:39AM (#39614850)
Glad to hear it’s memorable!
Re:Bare minimum atw-style K interpreter for learning purposes on Wednesday January 17, 2024 @05:49PM (#39034695)
Everything I've found that's public is documented here:

https://gist.github.com/chrispsn/da00835bb122c42f429a084df83...

The kparc.com links are down though.

Re:K: We need to talk about group on Saturday April 01, 2023 @12:37AM (#35397191)
I think we need some kind of grouping function, but it doesn't have to be the 'generate group indices' function. I'm sure we'll have alternatives available such as `update ... by`.
Re:K: We need to talk about group on Friday March 31, 2023 @09:11PM (#35395952)
In the Wordle dict example, it would have helped if a type system could tell me I was wrong when I assumed that an indexing miss would generate an empty list.
Re:K: We need to talk about group on Friday March 31, 2023 @05:47PM (#35394112)
Yep - added a link to some simple examples in the article (below). Throughout the article there are also a few links to executable versions of the code examples.

https://ngn.codeberg.page/k/#eJxdjssKwjAQRffzFddVFyLFoiiFQD8...

Re:K: We need to talk about group on Friday March 31, 2023 @05:46PM (#35394101)
Good point - added a simple explanation in the article:

Group tells you the places each element occurs in a list. It generates lists of indices.

Re:K: We need to talk about group on Friday March 31, 2023 @05:28PM (#35393920)
Yep, the comments are the BQN version.
Re:APL: An Array Oriented Programming Language (2018) on Thursday March 30, 2023 @07:08PM (#35380104)
I don't think user-level definitions of custom symbols are that useful, but for what it's worth, you can do it in ngn/k...

    (Π):!/:  / make table
    
    Π[`a   `b
     ( 1    2
       3    4)]
Re:K – A simple, fast vector programming language on Friday May 13, 2022 @05:28AM (#31365125)
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...

Re:Imperative Thinking and the Making of Sandwiches (2014) on Monday August 16, 2021 @05:08AM (#28196226)
> So what would a general purpose language look like if it took these ideas to heart?

K or LINQ?

Re:The Tyranny of Spreadsheets on Friday July 23, 2021 @04:18AM (#27928429)
A nice shortcut is Ctrl-Shift-U to toggle single- or multi-line view.
Re:K: War on Raze on Thursday July 15, 2021 @05:55PM (#27850590)
> The results of ⍸ for different rank arguments are actually inconsistent.

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

Re:Benefits of 2D code layouts (2018) on Thursday May 27, 2021 @07:45AM (#27301843)
A mini-map is a cool idea! In Excel I often temporarily zoom out to get a big picture view of the program structure.
Re:Notation as a Tool of Thought on Monday November 30, 2020 @07:48AM (#25253210)
You didn't mention it, so for avoidance of doubt: have you heard of k?

Commercial k variants come with a columnar data store (see Kx's q/kdb+, Shakti's k9).

Older »