3 ms·
I had commented on Chen's post, here: http://franklinchen.com/blog/2011/12/08/revisiting-knuth-and-mcilroys-word-count-programs/#comment-1593558515 http://fran
by vram22 9y ago
I had commented on Chen's post, here:
http://franklinchen.com/blog/2011/12/08/revisiting-knuth-and-mcilroys-word-count-programs/#comment-1593558515 http://franklinchen.com/blog/2011/12/08/revisiting-knuth-and...
and linked to a blog post of mine, in which I too had written two solutions (one in Python and one in shell) to the original problem posed to Knuth by Bentley. Fun.
Here are my solutions:
https://jugad2.blogspot.in/2012/07/the-bentley-knuth-problem-and-solutions.html https://jugad2.blogspot.in/2012/07/the-bentley-knuth-problem...
A roughly similar problem is posed and solved in the Kernighan and Pike book, The Unix Programming Environment, IIRC, where they mention it as a nice example of the power of combining components, which is a key part of the Unix philosophy - quoted by commenter sswam in Chen's post:
[ This is the Unix philosophy:
Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
-- Doug McIllroy ]
- Koshkin 9y ago> text streams It is important to understand that this UNIX programming guideline (as well as others) only works in the particular context, which is made clear by the fact that UNIX was not designed, originally, to be an operating system for a server or an embedded device, or, for that matter, for batch processing in the sense OS/360 was, for example. Rather, it was designed to allow a moderate-size group of people (mostly programmers) to use a computer in a time-sharing, interactive manner to enter and edit and otherwise process text-based data. Taken out of this (now mostly historical) context, this and other such guidelines should be seen with a healthy dose of suspicion.
- vram22 9y agoYes, good point. Though text streams are still valid nowadays too, it just depends on the usage and context, whether they are that useful or not. I've seen the discussions on HN about Unix text streams vs. JSON or vs. Powershell piping objects, etc. I do know about the background of the early Unix people and the initial uses to which it was put, having read about that.