3 ms·
Here's one half the size in k: p,:3/:_(p:9\:!81)%3 s:{*(,x)(,/{@[x;y;:;]'&21=x[&|/p[;y]=p]?!10}')/&~x} http://thesweeheng.wordpress.com/2008/11/30/more-su
by swannodette 15y ago
Here's one half the size in k:
p,:3/:_(p:9\:!81)%3
s:{*(,x)(,/{@[x;y;:;]'&21=x[&|/p[;y]=p]?!10}')/&~x}
http://thesweeheng.wordpress.com/2008/11/30/more-sudoku-solvers-in-k-and-q/ http://thesweeheng.wordpress.com/2008/11/30/more-sudoku-solv...
- phzbOx 15y agoIt would be great to have a javascript translation to compare it. This is still pretty amazing.
- silentbicycle 15y agoYou'd have to translate k's entire data model first. It's based on data-parallel, implicit looping over vectors -- like multiplying an entire vector by a constant in linear algebra. For an open-source implementation of a k-like language, check out Kona (https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona). (Full disclosure, I'm a contributor.) It's still a work in progress, but it's pretty far along.