Oct 17, 2022 22:17
Another variant: f:#1_{*{x}#(-:\+/10\x)!'x}\
Oct 17, 2022 22:14
Oct 16, 2022 03:48
A tad shorter: z@*>f'z
Aug 29, 2022 19:58
It's mentioned in the repl help: codeberg.org/ngn/k/src/branch/master/repl.k
Aug 29, 2022 19:57
(a;b;c):1 2 3
Aug 2, 2022 10:44
Happy to help!
Mar 26, 2022 16:43
No idea, sorry
Mar 26, 2022 16:04
You could steal ok's prm from github.com/JohnEarnest/ok/blob/…
Mar 26, 2022 10:24
Consider it disregarded
Mar 25, 2022 15:17
Mar 25, 2022 15:17
apply, but @coltim's fold works too
Mar 25, 2022 15:14
(*/:).!'2# there might be something shorter
Feb 17, 2022 13:59
@dzaima I use entr with a bit of vimscript that saves the buffer on any change, with two terminals side by side
Feb 15, 2022 13:55
Also works in ngn/k
Feb 15, 2022 13:37
n m/y is for (github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md#over), so y times multiply 1 with x
Feb 15, 2022 13:07
Or */y#x (shorter but doesn't work for array inputs)
Feb 15, 2022 13:06
y(x*)/1
Feb 11, 2022 13:33
@ngn Is k32 not supported anymore? It seems to exit with oom on startup
Feb 9, 2022 17:52
s:{(,x)!0N}'!pr      / hashtable: positions -> score
H:5/
g:{(s@pr!h)@h:H@x}   / get
p:{s[pr!h;h:H@x]:y;} / put
Feb 9, 2022 17:52
Turned out to be quite beautiful (and slightly faster) in the end:
Feb 9, 2022 17:49
Initialising like this works too: s:{(,x)!x}'!10
Feb 9, 2022 17:42
Actually, s[0]:s[0],(,3)!4 works
Feb 9, 2022 17:41
Expected 0N 3!0 4
Feb 9, 2022 17:41
s:10#,((,0N)!0)
s[0],:(,3)!4
s[0]
0N 3!(0 0N;0N 4)
Feb 9, 2022 17:41
Is this related?
Feb 9, 2022 17:34
Right
Feb 9, 2022 17:29
I have tests, I don't mind ;-)
Feb 9, 2022 17:27
That works for me
Feb 9, 2022 16:49
I see, interesting
Feb 9, 2022 16:45
What's actually happening in #{(!0)!!0}'100#0? Is # looking into the array or is ' doing something?
Feb 9, 2022 16:38
pr:1000003               / prime
s:pr#,()                 / hashtable: positions -> score
h:5/                     / hash
g:{*|*(*'h=)#s@pr!h:h@x} / get
p:{s[pr!h]:(,h,y),s[pr!h:h@x];} / put
Feb 9, 2022 16:38
So is there no way to make an array of dicts at the moment? Trying to improve a hashtable implementation:
Feb 8, 2022 14:18
Same thing happens with 100#,((!0)!0)
Feb 8, 2022 14:17
What's happening here (in ngn/k)?

q:{(!0)!!0}'100#0
#q
1
q
+(!0)!!0
Feb 5, 2022 00:03
1 1 1 2 2 {fr[x].y}/((1;3);(2;4))
Dec 4, 2021 19:29
Turns out 1=#? is shorter anyway, duh
Dec 4, 2021 19:05
Good point
Dec 4, 2021 19:05
Ah, right
Dec 4, 2021 18:59
Yes, like &': (at least in ok: github.com/JohnEarnest/ok/blob/gh-pages/docs/…)
Dec 4, 2021 18:57
I was thinking something like this (unless you know a shorter idiom): ngn.codeberg.page/k/#eJxT01eIsVW3MjRQNgAADQQCJA==
Dec 4, 2021 18:43
Would it make sense for =': to be given the first item as the initial value as a special case? Would be useful for checking if all elements are the same
Dec 1, 2021 02:46
Does ngn/k not have 5: any more? (I got w:{"/dev/stdout"0:`k@x} for now)
Oct 1, 2021 05:15
@Bubbler I believe that's incorrect for f[9;"DyalogAPL"]
Oct 1, 2021 03:57
(I changed DyalogAPL to ngn/k and didn't notice the order requirement)
Oct 1, 2021 03:55
@xpqz Fixed, thanks: {(x#y;x_y)1 0=x<0} (@coltim's solution is two bytes shorter)
Sep 20, 2021 03:18
@chrispsn Thanks, appreciated
Sep 20, 2021 03:16
@coltim Nice one, < and > are useful on booleans which I hadn't considered
Sep 20, 2021 03:15
@coltim Indeed, fixed
Sep 19, 2021 08:01
Yeah
Sep 19, 2021 07:59
I did some of the recent tryapl problems. Pretty happy about the results, but suggestions are welcome: copy.sh/k/tryapl/2020.k