355 karma · joined May 20, 2021
{m:(x,x)#til x*x; r:til[x]-x div 2; 2(flip r rotate')/m}
generates magic squares of odd size, and the method is much clearer. This isn't even golfed as the variables have been left.a = x^1 + x^4 + x^7 + ... = x(1 + x^3 + x^6 + ...) = x/(1-x^3)
a + a^3 + a^5 + ... = a(1 + a^2 + a^4 + ...) = a/(1-a^2)
Substitute + simplify. I don't think this is beyond a (fairly smart) elementary school student.
To me professional implies production/real world/paid work, not just an unfinished academic project.
]runtime -repeat=1s 'v←k1 ⋄ v⌿⍨←v≠2'
\* Benchmarking "v←k1 ⋄ v⌿⍨←v≠2", repeat=1s
┌──────────┬──────────────┐
│ │(ms) │
├──────────┼──────────────┤
│CPU (avg):│0.008491847826│
├──────────┼──────────────┤
│Elapsed: │0.008466372283│
└──────────┴──────────────┘
]runtime -repeat=1s 'v←k2 ⋄ v⌿⍨←v≠2'
\* Benchmarking "v←k2 ⋄ v⌿⍨←v≠2", repeat=1s
┌──────────┬────────────┐
│ │(ms) │
├──────────┼────────────┤
│CPU (avg):│0.8333333333│
├──────────┼────────────┤
│Elapsed: │0.83 │
└──────────┴────────────┘Either everyone who uses array languages does actually find them readable, or they're all persistently lying for... what reason? And forcing themselves to use something they don't find readable? Why would anyone do that! Especially considering a lot of array language users are hobbyists, who have chosen to use them, it's not like they're forced to.
What do you have to gain from this stance, and why don't you believe people who tell you otherwise?
https://ngn.codeberg.page/k/#eJxVjsFugzAMhu95iiyWik1CIGPtIVG...
+/'{x:".",x;H:(-1+;1+i-)@'+|\m*i:!#m:x=\:"#."
R:(x=x)({[h;d;x;y;z](z#0),+\(((-z)_~"#"=x)&z_d>z)*(*y),(-z+1)_y-0^y h}. H)[x]/y
(*|R)-R@*|0,&1_*+m}.''1({("?"/:5#,x;,/5#,y)}.')\@[;1;.:]'" "\:'0:`:i/12.txtI don't see how k/q tables are only superior in niche situations, I'd much rather (and do) use them over pandas/polars/external DBs whenever I can. The speed is generally overhyped, but it is significant enough that rewriting something from pandas often ends up being much faster.
The last bits about IPC and typed objects basically boil down to python being a better glue language. That's probably true, but the ethos of array languages tends to be different, and less dependent on libraries.
Tables aren't niche, they're very useful! I looked at cloudpickle, and it seems to only do serialisation, I assume you'd need something else to do IPC too? The benefit of k's IPC is it's pretty seamless.
I'm not sure what you mean by inefficient hacks, generally you wouldn't try to construct some complicated ADT in k anyway, and if you need to you can still directly pass a dictionary or list or whatever your underlying representation is.