Hacker Newsnew | past | comments | ask | show | jobs | submit | chrispsn's commentslogin

Click on k, then k.zip.


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.


And perhaps further worth noting, the reason K uses dyadic & and | for minimum and maximum (respectively) is because logical AND and logical OR are identical to minimum and maximum if the arguments happen to be boolean (0/1). The notation and selection of primitives illustrate a useful and memorable symmetry.


Glad to hear it’s memorable!


Everything I've found that's public is documented here:

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

The kparc.com links are down though.



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


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.


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


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.


Nice! Sounds useful for scatter and gather algorithms

https://en.wikipedia.org/wiki/Gather/scatter_(vector_address...


Yep, the comments are the BQN version.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: