Saturday, July 19, 2014

On Paul Graham's Essays, and of Y Combinator

In literature, the ambition of the novice is to acquire the literary language; the struggle of the adept is to get rid of it
~ George Bernard Shaw

Some of the finest prose I've ever come across has been in the pages written by Paul Graham. In an essay that I wrote earlier (entitled On Lisp and Paul Graham)—and where I was referring to the two fine books Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp by Peter Norvig (Morgan Kaufmann, 1992) and On Lisp: Advanced Techniques for Common Lisp by Paul Graham (Prentice Hall, 1994)—I had noted that, "While both are replete with good advice, it is Paul Graham's On Lisp that also has the distinction of having been written spectacularly well; it has to be read to be believed!"

And it is precisely Graham's book On Lisp that I had in mind, as I chose the title of this essay that you're reading. Speaking of essay titles, and going about it a bit recursively, here's what Graham observed about the title of his book On Lisp
The title is intended to stress the importance of bottom-up programming in Lisp. Instead of just writing your program in Lisp, you can write your own language on Lisp, and write your program in that... Lisp was meant from the start to be an extensible language. The language itself is mostly a collection of Lisp functions, no different from the ones you define yourself...
So this is an acknowledgment of, and appreciation for, the fine essays—and books, to be sure—that Graham has written. This essay that you're reading is partly entitled On Paul Graham's Essays because I've gained so much from reading them over the years—Each writer has to find his or her own voice, though I confess that I've been drawn toward emulating his writing style. In particular, his book Hackers & Painters: Big Ideas from the Computer Age (O'Reilly) is a joy to read. Do check it out to see the care that he has lavished in crafting the narrative...
Sometimes I will stay up in my room for a day trying to get two sentences that will flow, that will just seem as if they were always there.
~ Maya Angelou, in Conversations with Maya Angelou, ed. Jeffrey M. Elliot (Jackson, MS: University Press of Mississippi, 1989), p.59
I'll leave it to you to look up his fine essays and books. Meanwhile, if only to convey a flavor of his stellar writing, here is an excerpt from On Lisp. In particular, look for the sublime metaphors that Graham uses in the second of the following two paragraphs with the cue sentence Language and program evolve together:
...The traditional approach is called top-down design: you say “the purpose of the program is to do these seven things, so I divide it into seven major subroutines. The first subroutine has to do these four things, so it in turn will have four of its own subroutines,” and so on. This process continues until the whole program has the right level of granularity—each part large enough to do something substantial, but small enough to be understood as a single unit. 
Experienced Lisp programmers divide up their programs differently. As well as top-down design, they follow a principle which could be called bottom-up design—changing the language to suit the problem. In Lisp, you don’t just write your program down toward the language, you also build the language up toward your program. As you’re writing a program you may think “I wish Lisp had such-and-such an operator.” So you go and write it. Afterward you realize that using the new operator would simplify the design of another part of the program, and so on. Language and program evolve together (italics are mine). Like the border between two warring states, the boundary between language and program is drawn and redrawn, until eventually it comes to rest along the mountains and rivers, the natural frontiers of your problem. In the end your program will look as if the language had been designed for it. And when language and program fit one another well, you end up with code which is clear, small, and efficient.
And this essay that you're reading is partly entitled Of Y Combinator if only to underscore that pursuing computer science, programming, and mathematics is eminently pragmatic, rather than a path that meanders around dainty ivory towers :-) My apologies to the purists who read this and cringe, though I hasten to add that the pursuit of pure mathematics and theoretical computer science is a worthy one, and has a lot of merit—Do check out The Nature of Computation (by Cristopher Moore and Stephan Mertens, Oxford University Press, 2011) for a lovely exposition of these subjects. That book is a work of tasteful art, if you will, and Marc Mézard at the Université de Paris probably captured its spirit the best when he wrote of it as follows
If you want to learn about complexity classes, scaling laws in computation, undecidability, randomized algorithms, how to prepare a dinner with Pommard, Quail and Roquefort, or the new ideas that quantum theory brings to computation, this is the right book. It offers a wonderful tour through many facets of computer science. It is precise and gets into details when necessary, but the main thread is always at hand, and entertaining anecdotes help to keep the pace.
~ Marc Mézard, Université de Paris Sud, Orsay
Randall Stross notes in his engrossing book The Launch Pad: Inside Y Combinator (Portfolio Trade, 2013) that Graham gave his company (Y Combinator) "...the curious name, borrowed from computer science... It is a mischievously obscure choice. It refers to a particular kind of function, for receiving data, performing a calculation, and sending a result back, that most programmers have never used or even understand."

If you look up Y Combinator in Wikipedia, you'll immediately get a disambiguation page notifying you that Y Combinator commonly refers either to
How about that—a bit of esoteric math jostling with the very best of American entrepreneurship—for highlighting the applicability of computer science, programming, and mathematics to solving real world problems? Another blog that may interest you is the one by Mark Chu-Carroll, and which goes by the name Good Math :-)

I sense that this essay is getting more and more into the territory inspired by Douglas R. Hofstadter's magnum opus Gödel, Escher, Bach: An Eternal Golden Braid as I weave more strands into the discussion thread, so I'm going to stop here, but not before leaving you with an intriguing quote from Orwell...
Writing a book is a horrible, exhausting struggle, like a long bout of some painful illness. One would never undertake such a thing if one were not driven on by some demon whom one can neither resist nor understand. For all one knows that demon is simply the same instinct that makes a baby squall for attention. And yet it is also true that one can write nothing readable unless one constantly struggles to efface one's own personality. Good prose is like a windowpane.
~ George Orwell, Why I Write (England Your England and Other Essays)
...and an equally intriguing one from Gloria Steinem
For me, writing is the only thing that passes the three tests of metier: (1) when I'm doing it, I don't feel that I should be doing something else instead; (2) it produces a sense of accomplishment and, once in a while, pride; and (3) it's frightening.
~ Gloria Steinem

No comments:

Post a Comment