3 ms·
"But the book doesn't mention either technique..." As other commenters are pointing out, the book's aim is to teach imperative programming with C to students
by yp_master 13y ago
"But the book doesn't mention either technique..."
As other commenters are pointing out, the book's aim is to
teach imperative programming with C to students of SML. It is not aimed at teaching functional programming in C.
The technique you describe -- using what UNIX offers, e.g., pipe and fork -- is used a lot by djb.
This book seems like a gentle intro to C.
And there's nothing wrong with keeping things simple in the beginning.
With respect to books and tutorials on C, I have seen much
worse.
Master the basics of C, then go read djb's code for lessons
on how to structure programs and smartly utilise what UNIX
has to offer. Keep K&R and Stevens nearby for reference.
A classic example is passing file descriptors instead of using a pipe function that opens a shell. There is no book on C that teaches that, but it is elegant programming indeed.
Even when one strives to keep things simple, C (and UNIX) have many gotchas.
There's a lot to learn.
This book doesn't overwhelm the reader.
Personally, I like the approach.
Lots of short consistent examples.
Lucid writing style, too.
- e12e 13y agoThat section on linked lists (cons in c and sml) was really nice. I don't think I've ever seen such clear, plain c for working with singly linked lists (which even checks the return code for malloc!). I actually had to look up what K&R had on it, and there's a section on tree-structures -- but it ends up being cluttered (although that's justifiable in K&R -- the focus isn't just on simple example code). Disclaimer: I don't actually know C :-) [edit: link: http://eprints.eemcs.utwente.nl/1077/08/list.html http://eprints.eemcs.utwente.nl/1077/08/list.html ]