There's a common cliché, that C programs, as embodied in Unix, are probably the most widely used form of functional programming - or at least CSP. This example is idiomatic;
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.
"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.
That 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).
@colmmacc would you please mind submitting or sharing the link to the book, paper or ressource you think that teaches the elegant Advanced Functional C Programming techniques you mention? I'd definitely upvote it.
I'm confused by the title of this article. The copyright in the PDF is 1999, not 1997, and it says it's about imperative programming in C, not functional programming. It says it's for people who learned functional programming in SML, but now need or want to learn imperative programming.
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.