A Sudoku Solver in APL

Dyalog · 47K views · 2012 · 9:43

Open on YouTube

Functional programmingAlgorithms & data structuresdemo

Why Hacker News recommends it

Strongly recommended as a beautiful demonstration that APL can be read and reasoned about step by step.

What it is

A Dyalog demonstration of developing a Sudoku solver in APL, using an algorithm by Arthur Whitney with performance work by John Scholes. The narration steps through the array-oriented solution.

Recommended by 4 HN commenters across 4 different months, 2015 to 2022.

What Hacker News said

Strong rec geocar · 2019-07 · on “Non-English-based programming languages”

APL is great. If you haven't seen them, the late John Scholes did a number of absolutely beautiful demonstrations programming in APL[1], [2], [3]. [1]: [LINK] [2]: [this video] [3]: [LINK]

Strong rec paliilap · 2019-08 · on “J can look like APL or English”

That 1975 APL demonstration is lovely. Much has been preserved in Dyalog and GNU APL - it's very interesting to see how timeless the core APL functions are. I'm very fond of a number of videos by the late John Scholes narrating APL solutions step by step, including the well-known demonstration of Conway's Game of Life in APL (0). His videos on depth-first search (1) and solving sudoku (2) are also brilliant. (0) [LINK] (1) [LINK] (2) [this video]

Strong rec moonchild · 2020-08 · on “J Notation as a Tool of Thought”

> My point was that general programming usually looks more like writing the sorting algorithm than simply calling it. Thus, I would be more interested in seeing real examples of how the properties of J allow you to write algorithms more concisely or otherwise better. Ah - I see. Here[1] is quicksort in j. John scholes's videos are excellent and very illustrative, though they deal with apl rather than j; conway's game of life[2] and sudoku[3]. > The article showed how J solves some mathematical problems with built in functions or their built-in modifiers. But in general programming, you won't find a function that does exactly what you wanted, maybe with a little adverb. You'll usually have to

Strong rec lizardactivist · 2022-03 · on “Dyalog APL 18.2”

I've always liked this video, where one of the Dyalog developers effortlessly writes a Sudoku solver in APL: [this video]

Cites wickawic · 2015-07 · on “Solving Every Sudoku Puzzle (2006)”

I've noticed that solving a sudoku is something of a rosetta stone for how people program. Norvig's solution is very straightforward in hindsight, but I think that code was either the result of many iterations or of a career of making progressively more readable code. Here are some other sudoku solvers that give more insight into the coder than the problem: Sudoku in APL: [this video] Test driven sudoku: [LINK]

Cites kick · 2020-03 · on “Stages of denial in encountering K”

I'm very much a believer in concise notation (more than most people I've worked with), but the advantages of having a name that can be unambiguously spoken are large enough to outweigh a small constant factor. I don't believe this holds up to scrutiny. APL as a language was made to be spoken, and it seems to have succeeded in that. Alan Perlis briefly touched on that in a great paper,[1] and just about everyone who's worked with the language and its derivatives agrees that your statement isn't true. The idea that APL and its derivatives can't be "read and talked about" is frankly ignoring reality by any stretch of the imagination. For example, here's [2] [3] [4] some videos disproving your s