Functional C (1997)
eprints.eemcs.utwente.nl
eprints.eemcs.utwente.nl
grep -c foo * | uniq | sort -rn
It's more than possible to structure C programs this way internally too, elegant even. Use forks and pipes if you want to keep it simple, build co-routines if you're up for it. It's probably the most practical and beneficial way you can re-apply the lessons of FP to C.But the book doesn't mention either technique - just weird and ugly tricks to emulate tail-recursion, cons et al, probably the least effective parts of FP to try to use in C.
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.
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 ]
It's not about functional-as-a-religion coding in C, and it really is a beginners book. Good though.
Pieter always used to say that he got around 50 pence per copy sold (from a roughly £15 pricetag)and if we found a typo we could have our 50p back :)
Yep, 'functional' is an overloaded term.