HackerTrans
TopNewTrendsCommentsPastAskShowJobs

chrispsn

no profile record

Submissions

Arthur Whitney releases an open-source subset of K with MIT license

shakti.com
294 points·by chrispsn·2 ปีที่แล้ว·227 comments

K: Default Dicts?

gist.github.com
2 points·by chrispsn·2 ปีที่แล้ว·0 comments

Show HN: REPL.club – client-side interpreters in the browser

repl.club
2 points·by chrispsn·3 ปีที่แล้ว·0 comments

K: Default Dicts?

gist.github.com
2 points·by chrispsn·3 ปีที่แล้ว·0 comments

K: We need to talk about group

gist.github.com
112 points·by chrispsn·3 ปีที่แล้ว·98 comments

comments

chrispsn
·2 ปีที่แล้ว·discuss
Click on k, then k.zip.
chrispsn
·2 ปีที่แล้ว·discuss
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.
chrispsn
·2 ปีที่แล้ว·discuss
Glad to hear it’s memorable!
chrispsn
·2 ปีที่แล้ว·discuss
Everything I've found that's public is documented here:

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

The kparc.com links are down though.
chrispsn
·3 ปีที่แล้ว·discuss
https://secwang.github.io/ngnkcart/
chrispsn
·3 ปีที่แล้ว·discuss
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`.
chrispsn
·3 ปีที่แล้ว·discuss
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.
chrispsn
·3 ปีที่แล้ว·discuss
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...
chrispsn
·3 ปีที่แล้ว·discuss
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.
chrispsn
·3 ปีที่แล้ว·discuss
Yep, the comments are the BQN version.
chrispsn
·3 ปีที่แล้ว·discuss
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)]