4 ms·
I think #5, which is probably going to be thought of as great wisdom for our age, is secretly an empty tautology. That is, my amateurish work in schemas and val
by drostie 9y ago
I think #5, which is probably going to be thought of as great wisdom for our age, is secretly an empty tautology. That is, my amateurish work in schemas and validating data structures and type systems has led me to think that there is a somewhat hard-to-see but extremely-important bijection between data structures and the control structures that consume them. (In many ways this is theoretically a non-issue as there are Church and Scott encodings of those data structures, but I think it also extends lists to for-loops and not just folds.) Seen that way it's really just saying "the most important part of the algorithm is figuring out the right basic control structures to build the algorithm out of." Well, yeah, that's what programming is.
- wtetzner 9y agoI think the wisdom is that data structures are declarative. It's also much easier to build an image in your head of a data structure than an algorithm, because an algorithm is actions over time.
- mamcx 9y agoThis is "obvious" for more experienced programmers, but vastly missed all the time. And the "experience" will change per-environment! Think in how many apply something like this well enough when inside his programming language, yet fail when using a RDBMS/NOSQL/CACHE/KV store. Or moving between UI/Backend. Or using the network, etc. ie. Is easy to see the truth at low-scale but do the same across all the stack is another thing. ---- I have some anecdote from my early days, when doing a school management app. After almost finished the porting from FoxPro DOS 2.6 (procedural) to Visual FoxPro 3 (OO, procedural, sql) some task were far slower than in DOS. Eventually I "discover" that was because some tables were normalized "by rows" instead of "by columns" (ie: The central process was around a table that, when printed in paper, was very much alike a pivot table). Then I change the tables to be as 1-1 to that pivot table. This massively improve the WHOLE program. Not only speed, but the simplification in coding and reduction on lines of the program was very big!
- gue5t 9y agoHow is a for-loop not a fold?
- JBiserkov 9y agoA fold is usually restricted to a combining function of 2 arguments - accumulated-so-far and current item. A for-loop's body has no such restrictions, it can access any number of neighbor elements if the algorithm so requires. a[i] = a[i-1] * a[i+1]
- rjeli 9y agoA for loop is a fold over the local context and the index
- baq 9y agoalgorithms + data structures = programs. literally the title of a classic CS book.