I'll sometimes gauge code complexity by comparing the number of lines of code against the output of tar -cf - . | gzip | base64 | wc -l IE "how much does it compress?" Looking at APL -- I'm reminded of what happens if I accidentally send the gzipped output to my tty... I'm impressed that there's anyone who can follow along (can you find the bug?) to code like p←{(↑⍵)∘{(⍺∨.=⍵)/⍳n×n∘}¨,⍵},(n*÷2){⍵,⍺⊥⌊⍵÷⍺}'⍳n n←⍴⍵ It re…
Arthur Whitney's one liner sudoku solver (2011)
31–40 of 210 posts
Re: Arthur Whitney's one liner sudoku solver (2011)
#32Re: Arthur Whitney's one liner sudoku solver (2011)
#33Earlier quoted context omitted.
From the linked page (and the one linked beyond that), it's a breadth-first search actually. Keep a list of possible puzzle states at all times, pick a blank cell (theoretically arbitrary, but in practice intelligently for performance), add copies of the state with each possibility for that state added.
That sounds like 100+ lines in python or similar languages…
Re: Arthur Whitney's one liner sudoku solver (2011)
#34Earlier quoted context omitted.
As a kdb+/Q programmer I would say it depends on the type of problem. For example, when working with arrays of data it certainly is easier to think and write “avg a+b” to add two arrays together and then take the average. In a non-array programming language you would probably first need to do some bounds checking, then a big for loop, a temporary variable to hold the sum and the count as you loop over the two arrays,…
Well no, not in a non-array programming language. In any language that has a semi-decent type/object system and some kind of functional programming support, `avg a+b` would just be `avg(a, b)`, which is not any easier or harder, with an array type defined somewhere. Once you make your basic array operations (Which they have to be made in q anyways, just in the stdlib), you can compose them just like you would in q, a…
What if I want to take the average difference of two arrays?
Re: Arthur Whitney's one liner sudoku solver (2011)
#35Re: Arthur Whitney's one liner sudoku solver (2011)
#36"one line in your custom language" is not one line at all lol
Why array languages seem to gravitate to symbol soup that makes regex blush I'll never know.
Re: Arthur Whitney's one liner sudoku solver (2011)
#37Earlier quoted context omitted.
Meta: No need to DV a comment you don't like for no reason. Engage instead. Why not have a chat?
People are saturated with anger and frustration after doom scrolling. They engage with their pitchforks.
Re: Arthur Whitney's one liner sudoku solver (2011)
#38Earlier quoted context omitted.
Meta: No need to DV a comment you don't like for no reason. Engage instead. Why not have a chat?
Wouldn't it be more productive/rewarding to instead engage with comments I do like?
If have to ask: What's rewarding about only having your viewpoint reinforced?
Re: Arthur Whitney's one liner sudoku solver (2011)
#39I'll sometimes gauge code complexity by comparing the number of lines of code against the output of tar -cf - . | gzip | base64 | wc -l IE "how much does it compress?" Looking at APL -- I'm reminded of what happens if I accidentally send the gzipped output to my tty... I'm impressed that there's anyone who can follow along (can you find the bug?) to code like p←{(↑⍵)∘{(⍺∨.=⍵)/⍳n×n∘}¨,⍵},(n*÷2){⍵,⍺⊥⌊⍵÷⍺}'⍳n n←⍴⍵ It re…
Legitimately curious how APL programmers think about maintainability and readability. Is code just thoroughly commented or otherwise documented?
Re: Arthur Whitney's one liner sudoku solver (2011)
#40What baud is that? /s