<story><title>Peter Norvig&apos;s Sudoku solver: Clojure &amp; Python side by side</title><url>http://jkkramer.wordpress.com/2011/03/29/clojure-python-side-by-side/</url></story><parent_chain></parent_chain><comment><author>beagle3</author><text>It is not really comparable, yet, I will post Arthur Whitney&apos;s Sudoku solver (in the K language) , in its entirety here:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  p,:3/:_(p:9\:!81)%3
  s:{*(,x)(,/{@[x;y;:;]&apos;&amp;#38;21=x[&amp;#38;|/p[;y]=p]?!10}&apos;)/&amp;#38;~x}
&lt;/code&gt;&lt;/pre&gt;
( can be found with a test case in &lt;a href=&quot;http://nsl.com/k/sudoku/aw3.k&quot; rel=&quot;nofollow&quot;&gt;http://nsl.com/k/sudoku/aw3.k&lt;/a&gt; )&lt;p&gt;The Norvig code is smarter - it always tries to fill the square with the least options. The Whitney code is dumb - it just recursively tries everything that&apos;s not blocked by peers in order. Both backtrack on failure.&lt;p&gt;The codes are equally general - both work off a data driven peer list (peers, p). The K code runs much faster for most boards, but there are boards in which the Norvig heuristic makes a x100 difference.&lt;p&gt;Personally, I prefer the K version, although I&apos;m aware I am in the minority.</text></comment>
<story><title>Peter Norvig&apos;s Sudoku solver: Clojure &amp; Python side by side</title><url>http://jkkramer.wordpress.com/2011/03/29/clojure-python-side-by-side/</url></story><parent_chain></parent_chain><comment><author>rdtsc</author><text>Same thing for Erlang implementation:
 &lt;a href=&quot;https://github.com/apauley/sudoku-in-erlang&quot; rel=&quot;nofollow&quot;&gt;https://github.com/apauley/sudoku-in-erlang&lt;/a&gt;&lt;p&gt;Initially Python was faster, however after some discussion and some performance optimisations Erlang got faster:
 &lt;a href=&quot;http://erlang.org/pipermail/erlang-questions/2011-March/057176.html&quot; rel=&quot;nofollow&quot;&gt;http://erlang.org/pipermail/erlang-questions/2011-March/0571...&lt;/a&gt;&lt;p&gt;Of course, it is worth keeping in mind that they didn&apos;t also go and try to optimize the Python version. So perhaps after doing that Python would win again.</text></comment>