|
|
|
|
|
by fifilura
611 days ago
|
|
My 5c. Algorithmically it is optimal, many corner cases thought of to make as few loops as possible. But it is suboptimal in the sense that it uses for loops so it is not possible for an underlying engine to execute in parallel, or to optimize the looping in native (e.g. C) code. In short - the for loops are 'how'. Without loops it is much more 'what' which leaves it up to the computer to optimize |
|
Looking at https://news.ycombinator.com/item?id=41897526 caused me to try asking for a solution in a language that doesn't have `for` loops. Since SQL was taken, I tried Prolog:
Run: I'm in love. I both understand what is happening (I think I would understand it even if I didn't know the task description!) and could easily port optimizations from the previous solution.Maybe this is the point when being a polyglot developer - knowing tens of programming languages and their characteristics - will finally start paying off.