Hacker News new | past | comments | ask | show | jobs | submit login

I think what he has in mind are small programs that do some kind of nontrivial computation without much in the way of IO or UI. For example, [1] is a program from December 2019 that "finds n-bit binary squares that are palindromic".

A great way to get into this kind of thing if you're stuck for ideas is to go through the Online Encyclopedia of Integer Sequences [2] and just write little programs to print out the first n entries or whatever for a particular sequence. As other comments have suggested, don't worry about making them perfect, just get the numbers right and then move on to the next one.

[1] https://www-cs-faculty.stanford.edu/~knuth/programs/squarepa...

[2] https://oeis.org/




> is a program from December 2019 that "finds n-bit binary squares that are palindromic".

No dis-respect for Donald Knuth (who of course I found orders and orders of magnitude above programmers such as myself) and no dis-respect to people that found those types of programs interesting, but there are also programmers (like me) for whom those programs are just simple riddles, with almost no interest whatsoever.

They're like sudoku or crossroads, interesting and somehow intellectually stimulating but they don't help shape/change/modify the world around us. And I got hooked on programming when I realised how it could help me change the world around me and most of all how it could help me (and others) in trying to make sense on said world that surrounds us.


Well, yes, of course.

The question was about the sort of little programs someone could write daily, and the answer resembles crosswords or sudoku, which many people are in the habit of completing once a day.

Would completing one integer sequence algorithm (brilliant suggestion btw!) change the world around you? No, of course not.

Would it make you a better programmer, though? Certainly it would. Which would mean, when you settle down, crack your knuckles, and start changing the world, you'd do a better job of it.

Your objection strikes me as that of a hunter who won't go to the range, because when he fires his rifle, he wants to put meat on the table!


> Would completing one integer sequence algorithm (brilliant suggestion btw!) change the world around you? No, of course not.

Depends on the sequence, of course. I hear a lot of people would be interested in a fast algorithm for computing membership in OEIS A000040.


> They're like sudoku or crossroads, interesting and somehow intellectually stimulating but they don't help shape/change/modify the world around us.

I don't think this is accurate: sudoku and crossroads have deterministic known solutions. Solving them is a mostly mechanical feat and indeed somewhat useless beyond the joy of solving.

In contrast, the challenge of creating these sorts of programs is creative and open ended. It is very well possible that someone will come up with an even more efficient algorithm. Or a much simpler one. Or just a completely new strategy.

As to the usefulness, these little toy programs are a constant source of inspiration for solving actual real world problems. A perfect example of this is Algorithm X. One of Knuth's toys that solves Sudoku puzzles. The same algorithm is easily adapted to solve scheduling problems and actually is a major innovation.


No one was holding their breath for a program that finds n-bit binary squares that are palindromatic, but this kind of mucking about can be useful as exercise and as a source of new insights, both of which will aid the programmer in achieving more ambitious goals.

The musician doesn't noodle around randomly or repeat uninteresting exercises with the ambition that that in itself is going to constitute a meaningful and memorable work.


I think others have already done a good job of describing how programs like that help make you a better programmer, and can be inspiring.

I'd like to add that something that I find interesting and inspiring about programming is managing complexity. That's something that's not as easily explored with programs like the above. But for example, you could try to create as much of a spreadsheet program as possible in a few hours. Do that 4 times starting from scratch. How can you organise the code in such a way to make it easy to read, performant, maintainable, and fast to write? What language features will you take advantage of? Maybe try making a part of a word processor, an IDE, a raytracer, an HTML viewer, an FTS engine, a relational database, etc. Try implementing mvc, or reactive, or two way binding UIs. I would consider these sort of a different genre of poem, that let you explore a different problem space. Maybe this might be the genre that you're more interested in?


Checkout his latest fascicles on applications of zero-supressed binary decision diagrams to all sorts of problems. From beautiful tiling problems to travelling salesman.

His latest fascicles are bleeding edge when it comes to a general algorithm that solves a wide variety of problem instances very efficiently. (much similar to his Algorithm X, but superior in almost every way)


When the very adjacent sentence is “Poets have to write poems”, I think this question is like asking “what kinds of poems, not for the sake of poems, can you actually write…”, then ask about how they change the world, etc.

Even poets don't write poems just for the sake of poems — they write because it gives them pleasure, because they are moved by some strong feeling or because they have some irresistible urge to say something, etc. (And sometimes because they're being paid for it, or hope to be.) Anyway, here are some reasons (in no particular order, and not mutually exclusive—there's some overlap) for Knuth to write programs:

1. Because it gives him pleasure.

2. Because he wants to find out the answer to some question — for instance, how many knight's tours are unchanged under a 180° rotation?

3. Because he wants to experiment or gain more experience with some algorithm(s) or method(s) that he's learning or writing about.

4. Because he wants to collect data on their performance, so that as a scientist when he makes a statement like “a program using this algorithm finds the answer for N=13 using only 0.3 billion memory accesses”, it is a correct statement.

5. Because he wants to understand something better (e.g. his program for linear programming where he says he understood the simplex method clearly only after implementing it).

6. Because he wants to "debug" or interactively see what sub-components of some algorithm do.

7. Because he has encountered (or been posed) a hard problem and wants the challenge of solving it.

8. Because he has seen a beautiful program and wants to translate it to his preferred style, as he'd like more people to appreciate its clever ideas. (E.g. his reimplementation of the original "Colossal Cave Adventure" game of Crowther and Woods.)

9. Because he wants to provide this program as an illustration of some idea or algorithm mentioned in his books.

10. Because someone has asked him for the program.

One can easily imagine more reasons. Though at the rate of five a week it would be more than 7500 programs over the last 30 years, he has given a few examples on his webpage: https://cs.stanford.edu/~knuth/programs.html (Many of them are in CWEB so to help people who don't have `cweave` installed, I typeset them in 2017: https://github.com/shreevatsa/knuth-literate-programs/tree/m... — I ought to update the repository sometime.)


Well you can write an interpreter or a compiler for a simple language you design.

You can try to make text-based games.

You can make a bare-bones browser.

You can write a simulator for ..say.. classical mechanics.

Are none of these interesting for you?


You can't really write five of those in a week.


500 lines or less, hold my beer.


Is this your way of saying you're a programmer not a computer scientist? Because his job is as a scientist.

Calling his exercises simple riddles is disrespectful. It's like calling doing a 5km run every morning, simple walking. The proof is in the pudding, he has impacted the world in a profound way.

But on a more positive note. Which non-cs programmer heroes exists today? I'm thinking John Carmack.


Yeah, of course I have never thought as myself as a computer scientist, I like my job/title as a programmer, I don't see any downside in that, manipulating data is fun.

I don't personally have "programmer heroes", maybe it's because I'm 39 years old and as such I haven't believed in cowboy-like programmers for almost a decade now. I did strongly believe though in what Aaron Swartz used to do and in what he used to believe, i.e. an open internet and open data for almost everyone, but that dream died in the late 2000s - early 2010s and I don't think we'll ever going to get close to anything like that ever again.


No one said anything about cowboys? Just shining examples of programmers.

Maybe you are your own hero?


Many people praise Fabrice Bellard. Not sure if he's counted as a non-scientist, but his achievements are astounding.

Although I think that many heroes are hidden behind corporations. Those people who contributed most to Google Search or architectured Chrome. Those people who built systems everyone relies on. For example almost every Java project uses Spring Framework, but I'm sure that it was founded by one or few very talented people. And those examples are many, but not very public or exposed.


Fabrice Bellard seems like an awesome guy!

Do you guys think programmers don't recognise each others work as much as in other fields?


I don't really know much about other fields. Do architects recognize those who architected outstanding projects, like huge bridges and tallest skyscrapers?


There were quite a few people on the burnout[1] thread that wanted to change the world.

[1] https://news.ycombinator.com/item?id=22876241


Along these lines, Project Euler is great.


So is the blog "Programming Praxis". Its author has been posting short and interesting programming exercises at least once a week, but often more, for years.


Of course the answer for OP is reading and working through taocp, that practice makes you better which is why Knuth spent his life writing these books even if technically, they are as the Knuth states just a study of 'alg a compared to alg b' the byproduct is more practice that OP is looking for.


I feel like solving leetcoe problems would fall somewhere in the category of programs you're describing. (They seem like small problem solving programs.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: