Live data from Hacker News

Arthur Whitney's one liner sudoku solver (2011)

dfns.dyalog.com

11–20 of 210 posts

Re: Arthur Whitney's one liner sudoku solver (2011)

#11

Sudoku was always a meditative thing for me. It’s impossible not to win so long as you pay attention. Optimizing solutions seems contrary to the point to me.

I find that sodoku is not a math or even a logic puzzle, but rather an epistemology puzzle. Lots of how we know/how much we know, and if you get into speed with some failure tolerance through estimating probability it adds even more thought provoking rabbit holes.

Re: Arthur Whitney's one liner sudoku solver (2011)

#12

I’ve often wondered about languages like APL/k, are the programmers actually able to think about problems more efficiently?

Hillel Wayne writes about it on his newsletter every once in a while. He's convinced me that he does in fact think through some problems better in array languages but I still can't really conceive of what that experience is like.

Re: Arthur Whitney's one liner sudoku solver (2011)

#13
post #8

Not knowing K, am I correct in assuming this is a backtracking brute force solver?

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.

Re: Arthur Whitney's one liner sudoku solver (2011)

#14
post #9

Sudoku was always a meditative thing for me. It’s impossible not to win so long as you pay attention. Optimizing solutions seems contrary to the point to me.

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)

#15

I’ve often wondered about languages like APL/k, are the programmers actually able to think about problems more efficiently?

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, etc.

Probably the difference between like 6ish lines of code in some language like C versus the 6 characters above in Q.

But every language has features that help you reason about certain types of problems better. Functional languages with algebraic data types and pattern matching (think OCaml or F#) are nicer than switch statements or big if-else-if statements. Languages with built-in syntactic sugar like async/await are better at dealing with concurrency, etc.

Re: Arthur Whitney's one liner sudoku solver (2011)

#17
post #9

Sudoku was always a meditative thing for me. It’s impossible not to win so long as you pay attention. Optimizing solutions seems contrary to the point to me.

Meta: No need to DV a comment you don't like for no reason. Engage instead. Why not have a chat?

Downvotes and upvotes work together to manage the visibility of posts that align with the community's tastes.

While I myself found an opportunity to reply to the GP and didn't down vote them, their comment only engaged with the article in a shallow way and only then, seemingly, to just dismiss the concept of solver altogether.

It wasn't a offensive comment, but it didn't really contribute to the site in the way many people digging into deep technical walkthroughs like this expect to see.

Some downvotes weren't guaranteed, but they're not surprising and they're probably helping new readers stay engaged with more topical and technical alternatives.

It's not the end of the world to get a few downvotes, and it's almost never personal. It certainly isn't here.

Re: Arthur Whitney's one liner sudoku solver (2011)

#18
post #9

Sudoku was always a meditative thing for me. It’s impossible not to win so long as you pay attention. Optimizing solutions seems contrary to the point to me.

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?

Re: Arthur Whitney's one liner sudoku solver (2011)

#19

I’ve often wondered about languages like APL/k, are the programmers actually able to think about problems more efficiently?

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,…

Which is why C# is the giant ever increasing bag of tricks that it is (unkind people might say bloat…) ;-) Personally, I’m all for this; let me express the problem in whatever way is most natural.

There are limits, of course, and it’s not without downsides. Still, if I have to code in something all day, I’d like that “something” be as expressive as possible.

Post reply on HN