k code
banner
kcode.bsky.social
k code
@kcode.bsky.social
Arthur Whitney has released an open-source version of k! shakti.com/k
shakti
shakti merges database, language, connectivity, and event processing into one powerful system
shakti.com
June 1, 2024 at 9:51 AM
If you need to shift a list right, 0 :': will do it (right-each-prior). Replace zero with your seed of choice.

You can also use -1_0, . Do it in that order rather than 0,-1_ to ensure it works for empty lists.
February 14, 2024 at 1:49 AM
K is described as 'left of right' because we read 'f x' like in math: 'f of x'.
February 9, 2024 at 3:37 AM
February 9, 2024 at 3:20 AM
February 9, 2024 at 2:59 AM
Past k articles:

WAR ON RAZE gist.github.com/chrispsn/af6...

We need to talk about group. gist.github.com/chrispsn/345...

K: default dicts? gist.github.com/chrispsn/ff0...
We need to talk about group.
We need to talk about group. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
February 9, 2024 at 2:48 AM
February 9, 2024 at 1:53 AM
Flat ranges (f 3 2 => 0 1 2 0 1), same as ,/!':

{(!*|+/x)-&(0:':+\x)!x}

Or if you have an occurrence count primitive:

oc:{i-(i:<<x)x?x}
oc@&:

Reverse flat ranges (f 3 2 => 2 1 0 1 0), same as ,/|'!':

{(&a!x)-1+!*|a:+\x}
February 9, 2024 at 12:55 AM